]>
Commit | Line | Data |
---|---|---|
685307dc | 1 | #!/bin/sh |
2 | # | |
3 | # avahi-dnsconfd: Starts the Avahi dns configuration daemon | |
4 | # | |
7bf52e36 | 5 | # chkconfig: 345 35 65 |
685307dc | 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 | # | |
139edd66 | 12 | # $Id$ |
685307dc | 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 | |
139edd66 | 24 | msg_network_down "avahi-dnsconfd" |
685307dc | 25 | exit 1 |
26 | fi | |
27 | else | |
28 | exit 0 | |
29 | fi | |
30 | ||
139edd66 ER |
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 | ||
685307dc | 79 | # See how we were called. |
80 | case "$1" in | |
81 | start) | |
139edd66 | 82 | start |
685307dc | 83 | ;; |
84 | stop) | |
139edd66 | 85 | stop |
685307dc | 86 | ;; |
87 | restart) | |
139edd66 ER |
88 | stop |
89 | start | |
685307dc | 90 | ;; |
139edd66 ER |
91 | reload|force-reload) |
92 | reload | |
685307dc | 93 | ;; |
139edd66 ER |
94 | try-restart) |
95 | condrestart 0 | |
685307dc | 96 | ;; |
97 | status) | |
98 | status avahi-dnsconfd | |
99 | RETVAL=$? | |
100 | ;; | |
101 | *) | |
139edd66 | 102 | msg_usage "$0 {start|stop|restart|reload|force-reload|try-restart|status}" |
685307dc | 103 | exit 3 |
104 | esac | |
105 | ||
106 | exit $RETVAL |