]> git.pld-linux.org Git - packages/inn.git/blob - inn.init
- LSB conformance
[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_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network ]; then
23                 msg_network_down "INN"
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29                         
30 RETVAL=0
31 # See how we were called.
32 case "$1" in
33   start)
34         if [ ! -f /var/lock/subsys/inn ]; then
35                 msg_starting "INN"
36                 daemon su news -c inndstart
37                 if is_yes "$DOINNWATCH" ; then
38                         msg_starting "INN Watch"
39                         busy
40                         su news -c "umask 002
41                         /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0
42                         RETVAL=$?
43                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
44                         ps -C innwatch >/dev/null 2>&1 || usleep 500000
45                         if [ $RETVAL -eq 0 ] && ps -C innwatch >/dev/null 2>&1; then
46                                 ok
47                                 touch /var/lock/subsys/inn
48                         else
49                                 RETVAL=1
50                                 fail
51                         fi
52                 else
53                         touch /var/lock/subsys/inn
54                 fi
55         else
56                 msg_already_running "INN"
57         fi
58         ;;
59   stop)
60         if [ -f /var/lock/subsys/inn ]; then
61                 msg_stopping "INN"
62                 busy
63                 if ctlinnd shutdown "Stopping INN service"; then
64                         ok
65                 else
66                         fail
67                 fi
68
69                 if [ -f /var/run/news/innwatch.pid ]; then
70                         msg_stopping "INN Watch"
71                         busy
72                         if killall -9 innwatch; then
73                                 ok
74                         else
75                                 died
76                         fi
77                         rm -f /var/run/news/innwatch.pid \
78                         /var/run/news/LOCK.innwatch >/dev/null 2>&1
79                 fi
80
81                 if [ -f /var/run/news/infeed.pid ]; then
82                         msg_stopping "INN Feed"
83                         killproc innfeed -9
84                         rm -f /var/run/news/innfeed.pid >/dev/null 2>&1
85                 fi
86
87                 if [ -f /var/run/news/actived.pid ]; then
88                         msg_stopping "INN Actived"
89                         killproc actived -9
90                         rm -f /var/run/news/actived.pid >/dev/null 2>&1
91                 fi
92
93                 rm -f /var/lock/subsys/inn >/dev/null 2>&1
94         else
95                 msg_not_running INN
96         fi
97         ;;
98   status)
99         status innd
100         exit $?
101         ;;
102   reload|force-reload)
103         if [ -f /var/lock/subsys/inn ]; then
104                 msg_reloading "INN"
105                 busy
106                 ctlinnd reload all "Reloading" >/dev/null 2>&1;
107                 [ $? -ne 0 ] && RETVAL=7
108                 [ $RETVAL -eq 0 ] && ok || died
109         else
110                 msg_not_running INN >&2
111                 exit 7
112         fi
113         ;;
114   restart)
115         $0 stop
116         sleep 2
117         $0 start
118         ;;
119   *)
120         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
121         exit 3
122 esac
123
124 exit $RETVAL
This page took 0.043724 seconds and 4 git commands to generate.