Subversion Repositories configs

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/sh
2
#
3
# avahi-daemon: Starts the Avahi mDNS/DNS-SD Stack
4
#
5
# chkconfig:   345 24 02
6
# description: This is a daemon which runs on client machines to \
7
#              perform Zeroconf service discovery on a \
8
#              network. avahi-daemon must be running on systems that \
9
#              use Avahi for service discovery. Avahi-daemon should \
10
#              not be running otherwise.
11
# processname: avahi-daemon
12
# pidfile:     /var/run/avahi-daemon/pid
13
 
14
### BEGIN INIT INFO
15
# Required-Start:    messagebus
16
# Required-Stop:     messagebus
17
# Should-Start:      $syslog $network $local_fs
18
# Should-Stop:       $syslog $local_fs
19
# Default-Start:     3 4 5
20
# Default-Stop:      0 1 2 6
21
# Short-Description: Starts the Avahi Daemon
22
# Description:       This is a daemon which runs on client machines to
23
#                    perform Zeroconf service discovery on a
24
#                    network. avahi-daemon must be running on systems
25
#                    that use Avahi for service discovery.
26
#                    Avahi-daemon should not be running otherwise.
27
### END INIT INFO
28
 
29
AVAHI_BIN=/usr/sbin/avahi-daemon
30
AVAHI_OPTS="-D"
31
 
32
if [ "$1" = 'status' ]; then
33
    test -x $AVAHI_BIN || exit 4
34
else
35
    test -x $AVAHI_BIN || exit 5
36
fi
37
 
38
# Source function library.
39
. /etc/init.d/functions
40
. /etc/sysconfig/network
41
 
42
LOCKFILE=/var/lock/subsys/avahi-daemon
43
PIDFILE=/var/run/avahi-daemon/pid
44
RETVAL=0
45
 
46
base=${0##*/}
47
 
48
start() {
49
    # Check that networking is configured.
50
    [ ${NETWORKING} = "no" ] && exit 1
51
 
97 - 52
	[ "$EUID" != "0" ] && exit 4
4 - 53
	echo -n $"Starting Avahi daemon... "
54
	if [ -s /etc/localtime ]; then
55
	    cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
56
	fi;
57
        daemon --pidfile=${PIDFILE} $AVAHI_BIN $AVAHI_OPTS
58
        RETVAL=$?
59
        echo
60
        [ $RETVAL -eq 0 ] && touch ${LOCKFILE}
61
	return $RETVAL
62
}
63
 
64
stop() {
97 - 65
    	[ "$EUID" != "0" ] && exit 4
4 - 66
        echo -n $"Shutting down Avahi daemon: "
67
        killproc -p ${PIDFILE} $AVAHI_BIN
68
        RETVAL=$?
69
        [ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
70
        echo
71
	return $RETVAL
72
}
73
 
74
reload() {
75
        echo -n $"Reloading Avahi daemon... "
76
        killproc -p ${PIDFILE} $AVAHI_BIN -HUP
77
	RETVAL=$?
78
	echo
79
	return $RETVAL
80
}
81
 
82
restart() {
97 - 83
	[ "$EUID" != "0" ] && exit 4
4 - 84
	stop
85
	start
86
}
87
 
88
RETVAL=0
89
 
90
# See how we were called.
91
case "$1" in
92
  start)
93
	start
94
	;;
95
  stop)
96
	stop
97
	;;
98
  status)
99
	status -p ${PIDFILE} $AVAHI_BIN
100
        RETVAL=$?
101
	;;
102
  restart)
103
	restart
104
	;;
97 - 105
  reload|force-reload)
4 - 106
        reload
107
	;;
97 - 108
  condrestart|try-restart)
4 - 109
  	if [ -f $LOCKFILE ]; then
110
		restart
111
	fi
112
	;;
113
  *)
97 - 114
	echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
4 - 115
	exit 2
116
        ;;
117
esac
118
 
119
exit $RETVAL