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