]> git.pld-linux.org Git - packages/inn.git/blame - inn.init
- Release: 0.3
[packages/inn.git] / inn.init
CommitLineData
98d873eb 1#! /bin/sh
2#
3# innd InterNet News System
4#
6948b9ba 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.
98d873eb 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.
3a811b4b 21if is_yes "${NETWORKING}"; then
bab8ff79 22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
3a811b4b 23 msg_network_down "INN"
24 exit 1
25 fi
26else
27 exit 0
c747d3f4 28fi
29
1f488d5b 30RETVAL=0
98d873eb 31# See how we were called.
32case "$1" in
33 start)
ab0d6b82 34 if [ ! -f /var/lock/subsys/inn ]; then
072f06be 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"
9e528600 39 su news -c ovdb_init 2>&1 > /dev/null
072f06be 40 ok
41 fi
42
6948b9ba 43 msg_starting "INN"
25748b4f 44 daemon su news -c inndstart
1f488d5b 45 if is_yes "$DOINNWATCH" ; then
6948b9ba 46 msg_starting "INN Watch"
47 busy
1f488d5b 48 su news -c "umask 002
49 /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0
6948b9ba 50 RETVAL=$?
51 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn
e79be8fe 52 ps -C innwatch >/dev/null 2>&1 || usleep 500000
1f488d5b 53 if [ $RETVAL -eq 0 ] && ps -C innwatch >/dev/null 2>&1; then
54 ok
55 touch /var/lock/subsys/inn
6948b9ba 56 else
1f488d5b 57 RETVAL=1
58 fail
6948b9ba 59 fi
eb7b5845
JR
60 else
61 touch /var/lock/subsys/inn
1fa6ba32 62 fi
98d873eb 63 else
6d8c3adf 64 msg_already_running "INN"
98d873eb 65 fi
98d873eb 66 ;;
67 stop)
c747d3f4 68 if [ -f /var/lock/subsys/inn ]; then
c747d3f4 69 msg_stopping "INN"
70 busy
1f488d5b 71 if ctlinnd shutdown "Stopping INN service"; then
72 ok
c747d3f4 73 else
1f488d5b 74 fail
c747d3f4 75 fi
ab0d6b82 76
6948b9ba 77 if [ -f /var/run/news/innwatch.pid ]; then
78 msg_stopping "INN Watch"
79 busy
3a811b4b 80 if killall -9 innwatch; then
1f488d5b 81 ok
6948b9ba 82 else
1f488d5b 83 died
6948b9ba 84 fi
85 rm -f /var/run/news/innwatch.pid \
86 /var/run/news/LOCK.innwatch >/dev/null 2>&1
87 fi
ab0d6b82 88
6948b9ba 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
c747d3f4 94
6948b9ba 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
ab0d6b82 100
d78c6e1e 101 if [ -f /var/run/news/ovdb_monitor.pid ]; then
102 msg_stopping "INN ovdb_monitor"
103 killproc ovdb_monitor -15
104 fi
105
1f488d5b 106 rm -f /var/lock/subsys/inn >/dev/null 2>&1
d78c6e1e 107
c747d3f4 108 else
6d8c3adf 109 msg_not_running INN
ab0d6b82 110 fi
98d873eb 111 ;;
112 status)
113 status innd
1f488d5b 114 exit $?
98d873eb 115 ;;
1f488d5b 116 reload|force-reload)
c747d3f4 117 if [ -f /var/lock/subsys/inn ]; then
81574cc8 118 msg_reloading "INN"
6948b9ba 119 busy
3a811b4b 120 ctlinnd reload all "Reloading" >/dev/null 2>&1;
1f488d5b 121 [ $? -ne 0 ] && RETVAL=7
3a811b4b 122 [ $RETVAL -eq 0 ] && ok || died
6948b9ba 123 else
164b3a0a 124 msg_not_running INN >&2
1f488d5b 125 exit 7
c747d3f4 126 fi
98d873eb 127 ;;
128 restart)
129 $0 stop
272d2413 130 sleep 2
98d873eb 131 $0 start
132 ;;
133 *)
1f488d5b 134 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
135 exit 3
98d873eb 136esac
137
6948b9ba 138exit $RETVAL
This page took 0.372357 seconds and 4 git commands to generate.