]>
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 |
22 | if [ ! -f /var/lock/subsys/network ]; then | |
23 | msg_network_down "INN" | |
24 | exit 1 | |
25 | fi | |
26 | else | |
27 | exit 0 | |
c747d3f4 | 28 | fi |
29 | ||
1f488d5b | 30 | RETVAL=0 |
98d873eb | 31 | # See how we were called. |
32 | case "$1" in | |
33 | start) | |
ab0d6b82 | 34 | if [ ! -f /var/lock/subsys/inn ]; then |
6948b9ba | 35 | msg_starting "INN" |
25748b4f | 36 | daemon su news -c inndstart |
1f488d5b | 37 | if is_yes "$DOINNWATCH" ; then |
6948b9ba | 38 | msg_starting "INN Watch" |
39 | busy | |
1f488d5b | 40 | su news -c "umask 002 |
41 | /usr/bin/setsid /usr/bin/innwatch &" </dev/null >&0 2>&0 | |
6948b9ba | 42 | RETVAL=$? |
43 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn | |
e79be8fe | 44 | ps -C innwatch >/dev/null 2>&1 || usleep 500000 |
1f488d5b | 45 | if [ $RETVAL -eq 0 ] && ps -C innwatch >/dev/null 2>&1; then |
46 | ok | |
47 | touch /var/lock/subsys/inn | |
6948b9ba | 48 | else |
1f488d5b | 49 | RETVAL=1 |
50 | fail | |
6948b9ba | 51 | fi |
eb7b5845 JR |
52 | else |
53 | touch /var/lock/subsys/inn | |
1fa6ba32 | 54 | fi |
98d873eb | 55 | else |
6d8c3adf | 56 | msg_already_running "INN" |
98d873eb | 57 | fi |
98d873eb | 58 | ;; |
59 | stop) | |
c747d3f4 | 60 | if [ -f /var/lock/subsys/inn ]; then |
c747d3f4 | 61 | msg_stopping "INN" |
62 | busy | |
1f488d5b | 63 | if ctlinnd shutdown "Stopping INN service"; then |
64 | ok | |
c747d3f4 | 65 | else |
1f488d5b | 66 | fail |
c747d3f4 | 67 | fi |
ab0d6b82 | 68 | |
6948b9ba | 69 | if [ -f /var/run/news/innwatch.pid ]; then |
70 | msg_stopping "INN Watch" | |
71 | busy | |
3a811b4b | 72 | if killall -9 innwatch; then |
1f488d5b | 73 | ok |
6948b9ba | 74 | else |
1f488d5b | 75 | died |
6948b9ba | 76 | fi |
77 | rm -f /var/run/news/innwatch.pid \ | |
78 | /var/run/news/LOCK.innwatch >/dev/null 2>&1 | |
79 | fi | |
ab0d6b82 | 80 | |
6948b9ba | 81 | if [ -f /var/run/news/infeed.pid ]; then |
82 | msg_stopping "INN Feed" | |
83 | killproc innfeed -9 | |
84 | rm -f /var/run/news/innfeed.pid >/dev/null 2>&1 | |
85 | fi | |
c747d3f4 | 86 | |
6948b9ba | 87 | if [ -f /var/run/news/actived.pid ]; then |
88 | msg_stopping "INN Actived" | |
89 | killproc actived -9 | |
90 | rm -f /var/run/news/actived.pid >/dev/null 2>&1 | |
91 | fi | |
ab0d6b82 | 92 | |
1f488d5b | 93 | rm -f /var/lock/subsys/inn >/dev/null 2>&1 |
c747d3f4 | 94 | else |
6d8c3adf | 95 | msg_not_running INN |
ab0d6b82 | 96 | fi |
98d873eb | 97 | ;; |
98 | status) | |
99 | status innd | |
1f488d5b | 100 | exit $? |
98d873eb | 101 | ;; |
1f488d5b | 102 | reload|force-reload) |
c747d3f4 | 103 | if [ -f /var/lock/subsys/inn ]; then |
81574cc8 | 104 | msg_reloading "INN" |
6948b9ba | 105 | busy |
3a811b4b | 106 | ctlinnd reload all "Reloading" >/dev/null 2>&1; |
1f488d5b | 107 | [ $? -ne 0 ] && RETVAL=7 |
3a811b4b | 108 | [ $RETVAL -eq 0 ] && ok || died |
6948b9ba | 109 | else |
164b3a0a | 110 | msg_not_running INN >&2 |
1f488d5b | 111 | exit 7 |
c747d3f4 | 112 | fi |
98d873eb | 113 | ;; |
114 | restart) | |
115 | $0 stop | |
272d2413 | 116 | sleep 2 |
98d873eb | 117 | $0 start |
118 | ;; | |
119 | *) | |
1f488d5b | 120 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
121 | exit 3 | |
98d873eb | 122 | esac |
123 | ||
6948b9ba | 124 | exit $RETVAL |