]> git.pld-linux.org Git - packages/inn.git/blob - inn.init
- off by one malloc (allocator in glibc 2.2 is b0rken if it didn't catch this :/)
[packages/inn.git] / inn.init
1 #! /bin/sh
2 #
3 # innd          InterNet News System
4 #
5 # chkconfig:    345 95 05
6 # description:  inn is the most popular server for Usenet news. It allows \
7 #               you to setup local news servers. It can be difficult to \
8 #               set up properly though, so be sure to read /usr/doc/inn* \
9 #               before trying.
10
11 # Source function library.
12 . /etc/rc.d/init.d/functions
13
14 # Source networking configuration.
15 . /etc/sysconfig/network
16
17 # Daemon specific
18 . /usr/share/news/innshellvars
19
20 # Check that networking is up.
21 if is_no "${NETWORKING}"; then
22         msg_network_down "INN"
23         exit 1
24 fi
25                         
26
27 # See how we were called.
28 case "$1" in
29   start)
30         if [ ! -f /var/lock/subsys/inn ]; then
31                 msg_starting "INN"
32                 daemon su news -c inndstart
33                 if is_yes $DOINNWATCH ; then
34                         msg_starting "INN Watch"
35                         busy
36                         su news -c "umask 002 ; /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0
37                         RETVAL=$?
38                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
39                         ps -C innwatch >/dev/null 2>&1 || usleep 500000
40                         if ps -C innwatch >/dev/null 2>&1; then
41                                 deltext;ok
42                         else
43                                 deltext;fail
44                         fi
45                 else
46                         touch /var/lock/subsys/inn
47                 fi
48         else
49                 msg_already_running "INN"
50                 exit 1
51         fi
52         ;;
53   stop)
54         if [ -f /var/lock/subsys/inn ]; then
55                 msg_stopping "INN"
56                 busy
57                 if ctlinnd shutdown "Stopping INN service";then
58                         deltext;ok
59                 else
60                         deltext;fail
61                 fi
62
63                 if [ -f /var/run/news/innwatch.pid ]; then
64                         msg_stopping "INN Watch"
65                         busy
66                         if killall -9 innwatch; then
67                                 deltext;ok
68                         else
69                                 deltext;died
70                         fi
71                         rm -f /var/run/news/innwatch.pid \
72                         /var/run/news/LOCK.innwatch >/dev/null 2>&1
73                 fi
74
75                 if [ -f /var/run/news/infeed.pid ]; then
76                         msg_stopping "INN Feed"
77                         killproc innfeed -9
78                         rm -f /var/run/news/innfeed.pid >/dev/null 2>&1
79                 fi
80
81                 if [ -f /var/run/news/actived.pid ]; then
82                         msg_stopping "INN Actived"
83                         killproc actived -9
84                         rm -f /var/run/news/actived.pid >/dev/null 2>&1
85                 fi
86
87         else
88                 msg_not_running INN
89                 exit 1
90         fi
91         rm -f /var/lock/subsys/inn >/dev/null 2>&1
92         ;;
93   status)
94         status innd
95         ;;
96   reload)
97         if [ -f /var/lock/subsys/inn ]; then
98                 msg_reloading "INN"
99                 busy
100                 if ctlinnd reload all "Reloading" >/dev/null 2>&1; then
101                         deltext;ok
102                 else
103                         deltext;fail
104                 fi
105         else
106                 msg_not_running INN
107                 exit 1
108         fi
109         ;;
110   restart)
111         $0 stop
112         sleep 2
113         $0 start
114         ;;
115   *)
116         msg_usage "$0 {start|stop|status|restart|reload}"
117         exit 1
118         ;;
119 esac
120
121 exit $RETVAL
This page took 0.046627 seconds and 3 git commands to generate.