]>
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. |
0c8224cf | 23 | if [ "${NETWORKING}" = "no" ]; then |
24 | echo "WARNING: Networking is down. Inn service can't be runed " | |
25 | exit 1 | |
26 | fi | |
2a22f805 | 27 | |
78d01c81 | 28 | # Sanity check |
2a22f805 | 29 | [ -d /etc/news ] || exit 0 |
30 | [ -d /usr/lib/news ] || exit 0 | |
31 | [ -d /var/spool/news ] || exit 0 | |
32 | ||
78d01c81 | 33 | |
2a22f805 | 34 | # See how we were called. |
35 | case "$1" in | |
36 | start) | |
78d01c81 | 37 | # Check if the service is already running? |
38 | if [ ! -f /var/lock/subsys/news ]; then | |
39 | show Starting INND | |
40 | su news -c /etc/rc.d/rc.new | |
41 | else | |
42 | echo "portmap already is running" | |
43 | fi | |
2a22f805 | 44 | touch /var/lock/subsys/news |
45 | ;; | |
46 | stop) | |
47 | echo -n "Stopping INND service: " | |
48 | su news -c "/usr/lib/news/bin/ctlinnd shutdown 'stop required'" & | |
49 | # give it a try to die gracefuly | |
50 | sleep 5 | |
51 | # just in case innd didn't die gracefully | |
52 | if [ -f /var/run/news/innd.pid ] | |
53 | then | |
54 | kill -9 `cat /var/run/news/innd.pid` | |
55 | rm -f /var/run/news/innd.pid | |
56 | fi | |
57 | # always echo that INND is shut down | |
58 | echo -n "innd " | |
59 | if [ -f /var/run/news/innwatch.pid ] | |
60 | then | |
61 | kill -9 `cat /var/run/news/innwatch.pid` | |
62 | rm -f /var/run/news/innwatch.pid | |
63 | echo -n "innwatch " | |
64 | fi | |
65 | echo | |
66 | rm -f /var/lock/subsys/news /var/lock/news/* | |
67 | ;; | |
68 | status) | |
69 | status innd | |
70 | ;; | |
71 | restart) | |
78d01c81 | 72 | $0 stop |
73 | $0 start | |
74 | ;; | |
75 | reload) | |
2a22f805 | 76 | kill -HUP `cat /var/run/news/innd.pid` |
77 | ;; | |
78 | *) | |
78d01c81 | 79 | echo "Usage: $0 {start|stop|status|restart|reload}" |
2a22f805 | 80 | exit 1 |
81 | esac | |
82 | ||
83 | exit 0 |