]>
Commit | Line | Data |
---|---|---|
685307dc | 1 | #!/bin/sh |
2 | # | |
3 | # avahi-dnsconfd: Starts the Avahi dns configuration daemon | |
4 | # | |
5 | # chkconfig: 345 34 66 | |
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 | ||
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Get network config | |
18 | . /etc/sysconfig/network | |
19 | ||
20 | # Check that networking is up. | |
21 | if is_yes "${NETWORKING}"; then | |
22 | if [ ! -f /var/lock/subsys/network ]; then | |
23 | msg_network_down avahi-dnsconfd | |
24 | exit 1 | |
25 | fi | |
26 | else | |
27 | exit 0 | |
28 | fi | |
29 | ||
30 | ||
31 | # See how we were called. | |
32 | case "$1" in | |
33 | start) | |
34 | # Check if the service is already running? | |
35 | if [ ! -f /var/lock/subsys/avahi-dnsconfd ]; then | |
36 | msg_starting avahi-dnsconfd | |
37 | daemon --user avahi avahi-dnsconfd | |
38 | RETVAL=$? | |
39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/avahi-dnsconfd | |
40 | else | |
41 | msg_already_running avahi-dnsconfd | |
42 | fi | |
43 | ;; | |
44 | stop) | |
45 | if [ -f /var/lock/subsys/avahi-dnsconfd ]; then | |
46 | # Stop daemons. | |
47 | msg_stopping avahi-dnsconfd | |
48 | killproc avahi-dnsconfd | |
49 | rm -f /var/lock/subsys/avahi-dnsconfd | |
50 | else | |
51 | msg_not_running avahi-dnsconfd | |
52 | fi | |
53 | ;; | |
54 | restart) | |
55 | $0 stop | |
56 | $0 start | |
57 | exit $? | |
58 | ;; | |
59 | reload) | |
60 | if [ -f /var/lock/subsys/avahi-dnsconfd ]; then | |
61 | msg_reloading avahi-dnsconfd | |
62 | killproc avahi-dnsconfd -HUP | |
63 | RETVAL=$? | |
64 | else | |
65 | msg_not_running avahi-dnsconfd >&2 | |
66 | RETVAL=7 | |
67 | fi | |
68 | ;; | |
69 | force-reload) | |
70 | # if program allows reloading without stopping | |
71 | $0 reload | |
72 | ||
73 | # or if it doesn't | |
74 | $0 restart | |
75 | ||
76 | exit $? | |
77 | ;; | |
78 | status) | |
79 | status avahi-dnsconfd | |
80 | RETVAL=$? | |
81 | ;; | |
82 | *) | |
83 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
84 | exit 3 | |
85 | esac | |
86 | ||
87 | exit $RETVAL | |
88 | ||
89 | # This must be last line ! | |
90 | # vi:syntax=sh:tw=78:ts=8:sw=4 |