]> git.meshlink.io Git - catta/blob - initscript/fedora/avahi-dnsconfd.in
fix init scripts when called without any arguments. Closes rhbz 425491
[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 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
21 if [ "$1" == 'status' ]; then
22     test -x $AVAHI_BIN || exit 4
23 else
24     test -x $AVAHI_BIN || exit 5
25 fi
26
27 LOCKFILE=/var/lock/subsys/avahi-dnsconfd
28
29 base=${0##*/}
30
31 start() {
32     # Check that networking is configured.
33     [ ${NETWORKING} = "no" ] && exit 1
34
35         echo -n $"Starting Avahi DNS daemon... "
36         $AVAHI_BIN -D
37         RETVAL=$?
38         if [ $RETVAL = 0 ]; then
39                 touch $LOCKFILE
40                 success $"$base startup"
41         else
42                 failure $"$base startup"
43         fi
44         echo
45         return $RETVAL
46 }
47
48 stop() {
49         echo -n $"Shutting down Avahi DNS daemon: "
50         $AVAHI_BIN -k
51         RETVAL=$?
52         [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
53         rm -f $LOCKFILE
54         echo
55         return $RETVAL
56 }
57
58 reload() {
59         echo -n $"Reloading Avahi DNS daemon... "
60         $AVAHI_BIN -r
61         RETVAL=$?
62         [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
63         echo
64         return $RETVAL
65 }
66
67 restart() {
68         stop
69         start
70 }
71
72 RETVAL=0
73
74 # See how we were called.
75 case "$1" in
76   start)
77         start
78         ;;
79   stop)
80         stop
81         ;;
82   status)
83         $AVAHI_BIN -c
84         RETVAL=$?
85         [ $RETVAL = 0 ] && echo $"Avahi DNS daemon is running" || echo $"Avahi DNS daemon is not running"
86         ;;
87   restart)
88         restart
89         ;;
90   reload)
91         reload
92         ;;
93   condrestart)
94         if [ -f $LOCKFILE ]; then
95                 restart
96         fi
97         ;;
98   *)
99         echo $"Usage: $0 {start|stop|status|restart|condrestart}"
100         exit 2
101         ;;
102 esac
103
104 exit $RETVAL