]>
Commit | Line | Data |
---|---|---|
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 | 21 | if 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 | |
26 | else | |
27 | exit 0 | |
c747d3f4 | 28 | fi |
2ece0a15 | 29 | |
be8045c1 | 30 | start() { |
ab0d6b82 | 31 | if [ ! -f /var/lock/subsys/inn ]; then |
072f06be | 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" | |
2ece0a15 | 36 | daemon --pidfile /var/run/news/ovdb_monitor.pid --user news ovdb_init |
072f06be | 37 | fi |
38 | ||
6948b9ba | 39 | msg_starting "INN" |
6a4c3728 | 40 | daemon --pidfile /var/run/news/innd.pid --user news innd |
f717c4f8 PG |
41 | RETVAL=$? |
42 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn | |
1f488d5b | 43 | if is_yes "$DOINNWATCH" ; then |
6948b9ba | 44 | msg_starting "INN Watch" |
45 | busy | |
2ece0a15 | 46 | daemon --fork --pidfile /var/run/news/innwatch.pid --user news /usr/bin/innwatch |
6948b9ba | 47 | RETVAL=$? |
6a4c3728 | 48 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/innwatch |
1fa6ba32 | 49 | fi |
98d873eb | 50 | else |
6d8c3adf | 51 | msg_already_running "INN" |
98d873eb | 52 | fi |
be8045c1 PG |
53 | } |
54 | ||
55 | stop() { | |
c747d3f4 | 56 | if [ -f /var/lock/subsys/inn ]; then |
c747d3f4 | 57 | msg_stopping "INN" |
58 | busy | |
1f488d5b | 59 | if ctlinnd shutdown "Stopping INN service"; then |
60 | ok | |
c747d3f4 | 61 | else |
1f488d5b | 62 | fail |
c747d3f4 | 63 | fi |
ab0d6b82 | 64 | |
6948b9ba | 65 | if [ -f /var/run/news/innwatch.pid ]; then |
66 | msg_stopping "INN Watch" | |
2ece0a15 | 67 | killproc --pidfile /var/run/news/innwatch.pid innwatch -9 |
6948b9ba | 68 | rm -f /var/run/news/innwatch.pid \ |
69 | /var/run/news/LOCK.innwatch >/dev/null 2>&1 | |
70 | fi | |
ab0d6b82 | 71 | |
6948b9ba | 72 | if [ -f /var/run/news/infeed.pid ]; then |
73 | msg_stopping "INN Feed" | |
2ece0a15 | 74 | killproc --pidfile /var/run/news/infeed.pid innfeed -9 |
6948b9ba | 75 | rm -f /var/run/news/innfeed.pid >/dev/null 2>&1 |
76 | fi | |
c747d3f4 | 77 | |
6948b9ba | 78 | if [ -f /var/run/news/actived.pid ]; then |
79 | msg_stopping "INN Actived" | |
2ece0a15 | 80 | killproc --pidfile /var/run/news/actived.pid actived -9 |
6948b9ba | 81 | rm -f /var/run/news/actived.pid >/dev/null 2>&1 |
82 | fi | |
ab0d6b82 | 83 | |
d78c6e1e | 84 | if [ -f /var/run/news/ovdb_monitor.pid ]; then |
85 | msg_stopping "INN ovdb_monitor" | |
2ece0a15 TP |
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 | |
d78c6e1e | 88 | fi |
89 | ||
1f488d5b | 90 | rm -f /var/lock/subsys/inn >/dev/null 2>&1 |
d78c6e1e | 91 | |
c747d3f4 | 92 | else |
6d8c3adf | 93 | msg_not_running INN |
ab0d6b82 | 94 | fi |
be8045c1 PG |
95 | } |
96 | ||
97 | RETVAL=0 | |
98 | # See how we were called. | |
99 | case "$1" in | |
100 | start) | |
2ece0a15 | 101 | start |
be8045c1 PG |
102 | ;; |
103 | stop) | |
2ece0a15 | 104 | stop |
98d873eb | 105 | ;; |
106 | status) | |
2ece0a15 | 107 | status innwatch |
98d873eb | 108 | status innd |
4e2ae233 PG |
109 | if [ $? -eq 0 ]; then |
110 | innstat | |
111 | fi | |
98d873eb | 112 | ;; |
1f488d5b | 113 | reload|force-reload) |
c747d3f4 | 114 | if [ -f /var/lock/subsys/inn ]; then |
81574cc8 | 115 | msg_reloading "INN" |
6948b9ba | 116 | busy |
3a811b4b | 117 | ctlinnd reload all "Reloading" >/dev/null 2>&1; |
1f488d5b | 118 | [ $? -ne 0 ] && RETVAL=7 |
3a811b4b | 119 | [ $RETVAL -eq 0 ] && ok || died |
6948b9ba | 120 | else |
164b3a0a | 121 | msg_not_running INN >&2 |
1f488d5b | 122 | exit 7 |
c747d3f4 | 123 | fi |
98d873eb | 124 | ;; |
125 | restart) | |
be8045c1 | 126 | stop |
272d2413 | 127 | sleep 2 |
be8045c1 | 128 | start |
98d873eb | 129 | ;; |
130 | *) | |
1f488d5b | 131 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
132 | exit 3 | |
98d873eb | 133 | esac |
134 | ||
6948b9ba | 135 | exit $RETVAL |