]> git.pld-linux.org Git - packages/inn.git/blob - news.init
Standarized all rc scripts.
[packages/inn.git] / news.init
1 #! /bin/sh
2 #
3 # innd          InterNet News System
4 #
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
12
13 # Source function library
14 . /etc/rc.d/init.d/functions
15
16 # Get network config
17 . /etc/sysconfig/network
18
19 # Get service config
20 [ -f /etc/sysconfig/inn ] && . /etc/sysconfig/inn
21
22 # Check that networking is up.
23 [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down"; exit 0
24
25 # Sanity check
26 [ -d /etc/news ] || exit 0
27 [ -d /usr/lib/news ] || exit 0
28 [ -d /var/spool/news ] || exit 0
29
30
31 # See how we were called.
32 case "$1" in
33   start)
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
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)
69         $0 stop
70         $0 start
71         ;;
72   reload)
73         kill -HUP `cat /var/run/news/innd.pid`
74         ;;
75   *)
76         echo "Usage: $0 {start|stop|status|restart|reload}"
77         exit 1
78 esac
79
80 exit 0
This page took 0.065194 seconds and 4 git commands to generate.