]>
Commit | Line | Data |
---|---|---|
685307dc | 1 | #!/bin/sh |
2 | # | |
3 | # avahi-daemon: Starts the Avahi daemon | |
4 | # | |
5 | # chkconfig: 345 34 66 | |
6 | # | |
7 | # description: This is a daemon which runs on client machines to perform \ | |
8 | # Zeroconf service discovery on a network. avahi-daemon must be \ | |
9 | # running on systems that use Avahi for service discovery. \ | |
10 | # Avahi-daemon should not be running otherwise. | |
11 | # | |
12 | ||
13 | # Source function library | |
14 | . /etc/rc.d/init.d/functions | |
15 | ||
16 | # Get network config | |
17 | . /etc/sysconfig/network | |
18 | ||
19 | # Check that networking is up. | |
20 | if is_yes "${NETWORKING}"; then | |
21 | if [ ! -f /var/lock/subsys/network ]; then | |
22 | msg_network_down avahi-daemon | |
23 | exit 1 | |
24 | fi | |
25 | else | |
26 | exit 0 | |
27 | fi | |
28 | ||
18dae8be | 29 | start() { |
685307dc | 30 | # Check if the service is already running? |
31 | if [ ! -f /var/lock/subsys/avahi-daemon ]; then | |
32 | msg_starting avahi-daemon | |
c0049993 | 33 | _modprobe capability |
9c548ef6 | 34 | daemon avahi-daemon -D |
685307dc | 35 | RETVAL=$? |
36 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/avahi-daemon | |
37 | else | |
38 | msg_already_running avahi-daemon | |
39 | fi | |
18dae8be ER |
40 | } |
41 | ||
42 | stop() { | |
685307dc | 43 | if [ -f /var/lock/subsys/avahi-daemon ]; then |
44 | # Stop daemons. | |
45 | msg_stopping avahi-daemon | |
f0fbb15d | 46 | avahi-daemon -k |
685307dc | 47 | rm -f /var/lock/subsys/avahi-daemon |
f0fbb15d | 48 | ok |
685307dc | 49 | else |
50 | msg_not_running avahi-daemon | |
51 | fi | |
18dae8be ER |
52 | } |
53 | ||
54 | RETVAL=0 | |
55 | # See how we were called. | |
56 | case "$1" in | |
57 | start) | |
58 | start | |
59 | ;; | |
60 | stop) | |
61 | stop | |
685307dc | 62 | ;; |
63 | restart) | |
18dae8be ER |
64 | stop |
65 | start | |
685307dc | 66 | ;; |
613a6abb | 67 | reload|force-reload) |
685307dc | 68 | if [ -f /var/lock/subsys/avahi-daemon ]; then |
69 | msg_reloading avahi-daemon | |
f0fbb15d | 70 | avahi-daemon -r |
685307dc | 71 | RETVAL=$? |
72 | else | |
613a6abb | 73 | msg_not_running avahi-daemon |
685307dc | 74 | RETVAL=7 |
75 | fi | |
76 | ;; | |
685307dc | 77 | status) |
78 | status avahi-daemon | |
79 | RETVAL=$? | |
80 | ;; | |
81 | *) | |
82 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
83 | exit 3 | |
84 | esac | |
85 | ||
86 | exit $RETVAL |