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