]> git.meshlink.io Git - catta/blob - initscript/fedora/avahi-dnsconfd.in
bd4182eb5778eaac9a7986adcbb9b7a352232113
[catta] / initscript / fedora / avahi-dnsconfd.in
1 #!/bin/sh
2 #
3 # avahi-dnsconfd: Starts the Avahi DNS Configuration Daemon
4 #
5 # chkconfig:   - 96 02
6 # description: avahi-dnsconfd connects to a running avahi-daemon and \
7 #              runs the script /etc/avahi/dnsconf.action for each \
8 #              unicast DNS server that is announced on the local \
9 #              LAN. This is useful for configuring unicast DNS servers \
10 #              in a DHCP-like fashion with mDNS.
11 # processname: avahi-dnsconfd
12 # pidfile:     @localstatedir@/run/avahi-dnsconfd.pid
13
14 ### BEGIN INIT INFO
15 # Required-Start:    avahi-daemon
16 # Required-Stop:     avahi-daemon
17 # Should-Start:      $syslog $network $local_fs
18 # Should-Stop:       $syslog $local_fs
19 # Default-Start:     3 4 5
20 # Default-Stop:      0 1 2 6
21 # Short-Description: Starts the Avahi DNS Configuration Daemon
22 # Description:       avahi-dnsconfd connects to a running avahi-daemon
23 #                    and runs the script /etc/avahi/dnsconf.action for
24 #                    each unicast DNS server that is announced on the
25 #                    local LAN. This is useful for configuring unicast
26 #                    DNS servers in a DHCP-like fashion with mDNS.
27 ### END INIT INFO
28
29 AVAHI_BIN=@sbindir@/avahi-dnsconfd
30 AVAHI_OPTS="-D"
31
32 if [ "$1" = 'status' ]; then
33     test -x $AVAHI_BIN || exit 4
34 else
35     test -x $AVAHI_BIN || exit 5
36 fi
37
38 # Source function library.
39 . /etc/init.d/functions
40 . /etc/sysconfig/network
41
42 LOCKFILE=@localstatedir@/lock/subsys/avahi-dnsconfd
43 PIDFILE=@localstatedir@/run/avahi-dnsconfd.pid
44 RETVAL=0
45
46 base=${0##*/}
47
48 start() {
49     # Check that networking is configured.
50     [ ${NETWORKING} = "no" ] && exit 1
51
52         echo -n $"Starting Avahi DNS daemon... "
53         daemon --pidfile=${PIDFILE} $AVAHI_BIN $AVAHI_OPTS
54         RETVAL=$?
55         echo
56         [ $RETVAL -eq 0 ] && touch ${LOCKFILE}
57         return $RETVAL
58 }
59
60 stop() {
61         echo -n $"Shutting down Avahi DNS daemon: "
62         killproc -p ${PIDFILE} $AVAHI_BIN
63         RETVAL=$?
64         [ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
65         echo
66         return $RETVAL
67 }
68
69 reload() {
70         echo -n $"Reloading Avahi DNS daemon... "
71         killproc -p ${PIDFILE} $AVAHI_BIN -HUP
72         RETVAL=$?
73         echo
74         return $RETVAL
75 }
76
77 restart() {
78         stop
79         start
80 }
81
82 RETVAL=0
83
84 # See how we were called.
85 case "$1" in
86   start)
87         start
88         ;;
89   stop)
90         stop
91         ;;
92   status)
93         status -p ${PIDFILE} $AVAHI_BIN
94         RETVAL=$?
95         ;;
96   restart)
97         restart
98         ;;
99   reload)
100         reload
101         ;;
102   condrestart)
103         if [ -f $LOCKFILE ]; then
104                 restart
105         fi
106         ;;
107   *)
108         echo $"Usage: $0 {start|stop|status|restart|condrestart}"
109         exit 2
110         ;;
111 esac
112
113 exit $RETVAL