]> git.pld-linux.org Git - packages/avahi.git/blob - avahi-dnsconfd
- typo
[packages/avahi.git] / avahi-dnsconfd
1 #!/bin/sh
2 #
3 # avahi-dnsconfd:       Starts the Avahi dns configuration daemon
4 #
5 # chkconfig:            345 35 65
6 #
7 # description:  avahi-dnsconfd connects to a running avahi-daemon and runs the script \
8 #               /etc/avahi/dnsconf.action for each unicast DNS server that is announced \
9 #               on the local LAN. This is useful for configuring unicast DNS servers in \
10 #               a DHCP-like fashion with mDNS.
11 #
12 # $Id$
13
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23         if [ ! -f /var/lock/subsys/network ]; then
24                 msg_network_down "avahi-dnsconfd"
25                 exit 1
26         fi
27 else
28         exit 0
29 fi
30
31 start() {
32         # Check if the service is already running?
33         if [ -f /var/lock/subsys/avahi-dnsconfd ]; then
34                 msg_already_running "avahi-dnsconfd"
35                 return
36         fi
37
38         msg_starting "avahi-dnsconfd"
39         daemon /usr/sbin/avahi-dnsconfd -D
40         RETVAL=$?
41         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/avahi-dnsconfd
42 }
43
44 stop() {
45         if [ ! -f /var/lock/subsys/avahi-dnsconfd ]; then
46                 msg_not_running "avahi-dnsconfd"
47                 return
48         fi
49
50         # Stop daemons.
51         msg_stopping "avahi-dnsconfd"
52         avahi-dnsconfd -k && ok || fail
53         rm -f /var/lock/subsys/avahi-dnsconfd
54 }
55
56 reload() {
57         if [ ! -f /var/lock/subsys/avahi-dnsconfd ]; then
58                 msg_not_running "avahi-dnsconfd"
59                 RETVAL=7
60                 return
61         fi
62
63         msg_reloading "avahi-dnsconfd"
64         avahi-dnsconfd -r
65         RETVAL=$?
66 }
67
68 condrestart() {
69         if [ ! -f /var/lock/subsys/avahi-dnsconfd ]; then
70                 msg_not_running "avahi-dnsconfd"
71                 RETVAL=$1
72                 return
73         fi
74
75         stop
76         start
77 }
78
79 upstart_controlled
80
81 # See how we were called.
82 case "$1" in
83   start)
84         start
85         ;;
86   stop)
87         stop
88         ;;
89   restart)
90         stop
91         start
92         ;;
93   reload|force-reload)
94         reload
95         ;;
96   try-restart)
97         condrestart 0
98         ;;
99   status)
100         status avahi-dnsconfd
101         RETVAL=$?
102         ;;
103   *)
104         msg_usage "$0 {start|stop|restart|reload|force-reload|try-restart|status}"
105         exit 3
106 esac
107
108 exit $RETVAL
This page took 0.085389 seconds and 3 git commands to generate.