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