]> git.meshlink.io Git - catta/blob - initscript/fedora/avahi-daemon.in
Add init script support for fedora from Alexander Larsson
[catta] / initscript / fedora / avahi-daemon.in
1 #! /bin/sh
2 #
3 # avahi-daemon:       Starts the Avahi Daemon
4 #
5 # chkconfig: 345 34 66
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 start() {
27         echo -n $"Starting Avahi daemon... "
28         $AVAHI_BIN -D
29         RETVAL=$?
30         [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
31         echo
32         return $RETVAL
33 }
34
35 stop() {
36         echo -n "Shutting down Avahi daemon: "
37         $AVAHI_BIN -k
38         RETVAL=$?
39         echo
40         return $RETVAL
41 }
42
43 reload() {
44         echo -n "Reloading Avahi daemon... "
45         $AVAHI_BIN -r
46         RETVAL=$?
47         [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
48         echo
49         return $RETVAL
50 }
51
52
53 restart() {
54         stop
55         start
56 }
57
58 RETVAL=0
59
60 # See how we were called.
61 case "$1" in
62   start)
63         start
64         ;;
65   stop)
66         stop
67         ;;
68   status)
69         $AVAHI_BIN -c
70         [ $? = 0 ] && echo "Avahi daemon is running" || echo "Avahi daemon is not running"
71         ;;
72   restart)
73         restart
74         ;;
75   reload)
76         reload 
77         ;;
78   condrestart)
79         $AVAHI_BIN -c
80         [ $? = 0 ] && restart || :
81         ;;
82   *)
83         echo $"Usage: $0 {start|stop|status|restart|condrestart}"
84         exit 1
85 esac
86
87 exit $?