]> git.meshlink.io Git - catta/blob - initscript/fedora/avahi-daemon.in
a9d1e3264a60cab2ece56ecb2e8c18732c9a2da4
[catta] / initscript / fedora / avahi-daemon.in
1 #! /bin/sh
2 #
3 # avahi-daemon:       Starts the Avahi Daemon
4 #
5 # chkconfig: 345 97 02
6 # description: This is a daemon which runs on client machines to perform \
7 #              Zeroconf service discovery on a network. avahi-daemon must be \
8 #              running on systems  that use Avahi for service discovery. \
9 #              Avahi-daemon should not be running otherwise.
10 # processname: avahi-daemon
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-daemon
24 test -x $AVAHI_BIN || exit 5
25
26 LOCKFILE=/var/lock/subsys/avahi-daemon
27
28 base=${0##*/}
29
30 start() {
31         echo -n $"Starting Avahi daemon... "
32         if [ -s /etc/localtime ]; then
33             cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
34         fi;
35         $AVAHI_BIN -D
36         RETVAL=$?
37         if [ $RETVAL = 0 ]; then
38                 touch $LOCKFILE
39                 success $"$base startup"
40         else
41                 failure $"$base startup"
42         fi
43         echo
44         return $RETVAL
45 }
46
47 stop() {
48         echo -n $"Shutting down Avahi daemon: "
49         $AVAHI_BIN -k
50         RETVAL=$?
51         [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
52         rm -f $LOCKFILE
53         echo
54         return $RETVAL
55 }
56
57 reload() {
58         echo -n $"Reloading Avahi daemon... "
59         $AVAHI_BIN -r
60         RETVAL=$?
61         [ $RETVAL = 0 ] && success $"$base reload" || failure $"$base reload"
62         echo
63         return $RETVAL
64 }
65
66 restart() {
67         stop
68         start
69 }
70
71 RETVAL=0
72
73 # See how we were called.
74 case "$1" in
75   start)
76         start
77         ;;
78   stop)
79         stop
80         ;;
81   status)
82         $AVAHI_BIN -c
83         RETVAL=$?
84         [ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
85         ;;
86   restart)
87         restart
88         ;;
89   reload)
90         reload 
91         ;;
92   condrestart)
93         if [ -f $LOCKFILE ]; then
94                 restart
95         fi
96         ;;
97   *)
98         echo $"Usage: $0 {start|stop|status|restart|condrestart}"
99         exit 1
100 esac
101
102 exit $RETVAL
103