Fixed chkconfig values to make sure icmpdnd is started after ypbind.
[icmp-dn.git] / admin / icmpdnd
1 #!/bin/bash
2 #
3 # icmpdnd      This shell script takes care of starting and stopping
4 #              icmpdnd.
5 #
6 # chkconfig: - 30 70
7 # description: icmpdnd ICMP Domain Name responder daemon for Linux
8 # processname: icmpdnd
9 # pidfile: /var/run/icmpdnd.pid
10
11 # Source function library.
12 . /etc/rc.d/init.d/functions
13
14 # Source networking configuration.
15 [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
16
17 # Source icmpdn configureation.
18 if [ -f /etc/sysconfig/icmpdnd ] ; then
19         . /etc/sysconfig/icmpdnd
20 fi
21
22 # Check that networking is up.
23 [ "${NETWORKING}" = "no" ] && exit 0
24
25 [ -f /usr/sbin/icmpdnd ] || exit 0
26
27 RETVAL=0
28 prog="icmpdnd"
29
30 start() {
31         echo -n $"Starting $prog: "
32         daemon /usr/sbin/icmpdnd $ICMPDND_OPTS
33         RETVAL=$?
34         echo
35         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/icmpdnd
36         return $RETVAL
37 }
38
39 stop() {
40         echo -n $"Shutting down $prog: "
41         killproc "$prog"
42         RETVAL=$?
43         echo
44         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/icmpdnd
45         return $RETVAL
46 }
47
48 # See how we were called.
49 case "$1" in
50   start)
51         start
52         ;;
53   stop)
54         stop
55         ;;
56   restart)
57         stop
58         start
59         RETVAL=$?
60         ;;
61   condrestart)
62         if [ -f /var/lock/subsys/icmpdnd ]; then
63             stop
64             start
65             RETVAL=$?
66         fi
67         ;;
68   status)
69         status icmpdnd
70         RETVAL=$?
71         ;;
72   *)
73         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
74         exit 1
75 esac
76
77 exit $RETVAL