]> git.pld-linux.org Git - packages/inn.git/blob - inn.init
- add nnrpd_no_trace.patch - don't put L_TRACE messages to log, causes big
[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                         su news -c ovdb_init 2>&1 > /dev/null
36                         ok
37                 fi
38
39                 msg_starting "INN"
40                 daemon --user=news inndstart
41                 if is_yes "$DOINNWATCH" ; then
42                         msg_starting "INN Watch"
43                         busy
44                         su news -c "umask 002
45                         /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0
46                         RETVAL=$?
47                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
48                         ps -C innwatch >/dev/null 2>&1 || usleep 500000
49                         if [ $RETVAL -eq 0 ] && ps -C innwatch >/dev/null 2>&1; then
50                                 ok
51                                 touch /var/lock/subsys/inn
52                         else
53                                 RETVAL=1
54                                 fail
55                         fi
56                 else
57                         touch /var/lock/subsys/inn
58                 fi
59         else
60                 msg_already_running "INN"
61         fi
62 }
63
64 stop() {
65         if [ -f /var/lock/subsys/inn ]; then
66                 msg_stopping "INN"
67                 busy
68                 if ctlinnd shutdown "Stopping INN service"; then
69                         ok
70                 else
71                         fail
72                 fi
73
74                 if [ -f /var/run/news/innwatch.pid ]; then
75                         msg_stopping "INN Watch"
76                         busy
77                         if killall -9 innwatch; then
78                                 ok
79                         else
80                                 died
81                         fi
82                         rm -f /var/run/news/innwatch.pid \
83                         /var/run/news/LOCK.innwatch >/dev/null 2>&1
84                 fi
85
86                 if [ -f /var/run/news/infeed.pid ]; then
87                         msg_stopping "INN Feed"
88                         killproc innfeed -9
89                         rm -f /var/run/news/innfeed.pid >/dev/null 2>&1
90                 fi
91
92                 if [ -f /var/run/news/actived.pid ]; then
93                         msg_stopping "INN Actived"
94                         killproc actived -9
95                         rm -f /var/run/news/actived.pid >/dev/null 2>&1
96                 fi
97
98                 if [ -f /var/run/news/ovdb_monitor.pid ]; then
99                         msg_stopping "INN ovdb_monitor"
100                         killproc ovdb_monitor -15
101                 fi
102
103                 rm -f /var/lock/subsys/inn >/dev/null 2>&1
104
105         else
106                 msg_not_running INN
107         fi
108 }
109
110 RETVAL=0
111 # See how we were called.
112 case "$1" in
113   start)
114         start
115         ;;
116   stop)
117         stop
118         ;;
119   status)
120         status innd
121         if [ $? -eq 0 ]; then
122                 innstat
123         fi
124         ;;
125   reload|force-reload)
126         if [ -f /var/lock/subsys/inn ]; then
127                 msg_reloading "INN"
128                 busy
129                 ctlinnd reload all "Reloading" >/dev/null 2>&1;
130                 [ $? -ne 0 ] && RETVAL=7
131                 [ $RETVAL -eq 0 ] && ok || died
132         else
133                 msg_not_running INN >&2
134                 exit 7
135         fi
136         ;;
137   restart)
138         stop
139         sleep 2
140         start
141         ;;
142   *)
143         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
144         exit 3
145 esac
146
147 exit $RETVAL
This page took 0.081337 seconds and 3 git commands to generate.