]> git.pld-linux.org Git - packages/inn.git/blob - inn.init
- C: logrotate < 3.7.4 due to archiv -> archive transition
[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
30 RETVAL=0
31 # See how we were called.
32 case "$1" in
33   start)
34         if [ ! -f /var/lock/subsys/inn ]; then
35                 grep -v "#" /etc/news/inn.conf | grep ovmethod | grep ovdb 2>&1 >/dev/null
36                 RETVAL=$?
37                 if [ $RETVAL -eq 0 ]; then
38                         msg_starting "INN ovdb_monitor"
39                         su news -c ovdb_init 2>&1 > /dev/null
40                         ok
41                 fi
42
43                 msg_starting "INN"
44                 daemon su news -c inndstart
45                 if is_yes "$DOINNWATCH" ; then
46                         msg_starting "INN Watch"
47                         busy
48                         su news -c "umask 002
49                         /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0
50                         RETVAL=$?
51                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
52                         ps -C innwatch >/dev/null 2>&1 || usleep 500000
53                         if [ $RETVAL -eq 0 ] && ps -C innwatch >/dev/null 2>&1; then
54                                 ok
55                                 touch /var/lock/subsys/inn
56                         else
57                                 RETVAL=1
58                                 fail
59                         fi
60                 else
61                         touch /var/lock/subsys/inn
62                 fi
63         else
64                 msg_already_running "INN"
65         fi
66         ;;
67   stop)
68         if [ -f /var/lock/subsys/inn ]; then
69                 msg_stopping "INN"
70                 busy
71                 if ctlinnd shutdown "Stopping INN service"; then
72                         ok
73                 else
74                         fail
75                 fi
76
77                 if [ -f /var/run/news/innwatch.pid ]; then
78                         msg_stopping "INN Watch"
79                         busy
80                         if killall -9 innwatch; then
81                                 ok
82                         else
83                                 died
84                         fi
85                         rm -f /var/run/news/innwatch.pid \
86                         /var/run/news/LOCK.innwatch >/dev/null 2>&1
87                 fi
88
89                 if [ -f /var/run/news/infeed.pid ]; then
90                         msg_stopping "INN Feed"
91                         killproc innfeed -9
92                         rm -f /var/run/news/innfeed.pid >/dev/null 2>&1
93                 fi
94
95                 if [ -f /var/run/news/actived.pid ]; then
96                         msg_stopping "INN Actived"
97                         killproc actived -9
98                         rm -f /var/run/news/actived.pid >/dev/null 2>&1
99                 fi
100
101                 if [ -f /var/run/news/ovdb_monitor.pid ]; then
102                         msg_stopping "INN ovdb_monitor"
103                         killproc ovdb_monitor -15
104                 fi
105
106                 rm -f /var/lock/subsys/inn >/dev/null 2>&1
107
108         else
109                 msg_not_running INN
110         fi
111         ;;
112   status)
113         status innd
114         exit $?
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         $0 stop
130         sleep 2
131         $0 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.036705 seconds and 3 git commands to generate.