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