]>
Commit | Line | Data |
---|---|---|
2a22f805 | 1 | #! /bin/sh |
2 | # | |
3 | # innd InterNet News System | |
4 | # | |
78d01c81 | 5 | # chkconfig: 345 95 25 |
6 | # | |
7 | # description: inn is the most popular server for Usenet news. It allows \ | |
8 | # you to setup local news servers. It can be difficult to \ | |
9 | # set up properly though, so be sure to read /usr/doc/inn* \ | |
10 | # before trying. | |
11 | ||
2a22f805 | 12 | |
78d01c81 | 13 | # Source function library |
2a22f805 | 14 | . /etc/rc.d/init.d/functions |
15 | ||
78d01c81 | 16 | # Get network config |
2a22f805 | 17 | . /etc/sysconfig/network |
18 | ||
78d01c81 | 19 | # Get service config |
20 | [ -f /etc/sysconfig/inn ] && . /etc/sysconfig/inn | |
21 | ||
2a22f805 | 22 | # Check that networking is up. |
9dbce8c1 | 23 | [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down" && exit 0 |
2a22f805 | 24 | |
78d01c81 | 25 | # Sanity check |
2a22f805 | 26 | [ -d /etc/news ] || exit 0 |
27 | [ -d /usr/lib/news ] || exit 0 | |
28 | [ -d /var/spool/news ] || exit 0 | |
29 | ||
78d01c81 | 30 | |
2a22f805 | 31 | # See how we were called. |
32 | case "$1" in | |
33 | start) | |
78d01c81 | 34 | # Check if the service is already running? |
35 | if [ ! -f /var/lock/subsys/news ]; then | |
36 | show Starting INND | |
37 | su news -c /etc/rc.d/rc.new | |
38 | else | |
39 | echo "portmap already is running" | |
40 | fi | |
2a22f805 | 41 | touch /var/lock/subsys/news |
42 | ;; | |
43 | stop) | |
44 | echo -n "Stopping INND service: " | |
45 | su news -c "/usr/lib/news/bin/ctlinnd shutdown 'stop required'" & | |
46 | # give it a try to die gracefuly | |
47 | sleep 5 | |
48 | # just in case innd didn't die gracefully | |
49 | if [ -f /var/run/news/innd.pid ] | |
50 | then | |
51 | kill -9 `cat /var/run/news/innd.pid` | |
52 | rm -f /var/run/news/innd.pid | |
53 | fi | |
54 | # always echo that INND is shut down | |
55 | echo -n "innd " | |
56 | if [ -f /var/run/news/innwatch.pid ] | |
57 | then | |
58 | kill -9 `cat /var/run/news/innwatch.pid` | |
59 | rm -f /var/run/news/innwatch.pid | |
60 | echo -n "innwatch " | |
61 | fi | |
62 | echo | |
63 | rm -f /var/lock/subsys/news /var/lock/news/* | |
64 | ;; | |
65 | status) | |
66 | status innd | |
67 | ;; | |
68 | restart) | |
78d01c81 | 69 | $0 stop |
70 | $0 start | |
71 | ;; | |
72 | reload) | |
2a22f805 | 73 | kill -HUP `cat /var/run/news/innd.pid` |
74 | ;; | |
75 | *) | |
78d01c81 | 76 | echo "Usage: $0 {start|stop|status|restart|reload}" |
2a22f805 | 77 | exit 1 |
78 | esac | |
79 | ||
80 | exit 0 |