X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=initscript%2Ffedora%2Favahi-daemon.in;h=a9d1e3264a60cab2ece56ecb2e8c18732c9a2da4;hb=b671bd2201bf8e0a0af9f8da72ae80c3218d3000;hp=b9907bed0c6a045025173729cabcaf14ba762ae2;hpb=2a2ee0be70b99239f2cf99ea5b663eda965599f8;p=catta diff --git a/initscript/fedora/avahi-daemon.in b/initscript/fedora/avahi-daemon.in index b9907be..a9d1e32 100644 --- a/initscript/fedora/avahi-daemon.in +++ b/initscript/fedora/avahi-daemon.in @@ -2,7 +2,7 @@ # # avahi-daemon: Starts the Avahi Daemon # -# chkconfig: 345 34 66 +# chkconfig: 345 97 02 # description: This is a daemon which runs on client machines to perform \ # Zeroconf service discovery on a network. avahi-daemon must be \ # running on systems that use Avahi for service discovery. \ @@ -23,33 +23,46 @@ OTHER_AVAHI_OPTS="" AVAHI_BIN=@sbindir@/avahi-daemon test -x $AVAHI_BIN || exit 5 +LOCKFILE=/var/lock/subsys/avahi-daemon + +base=${0##*/} + start() { echo -n $"Starting Avahi daemon... " + if [ -s /etc/localtime ]; then + cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1 + fi; $AVAHI_BIN -D RETVAL=$? - [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup" + if [ $RETVAL = 0 ]; then + touch $LOCKFILE + success $"$base startup" + else + failure $"$base startup" + fi echo return $RETVAL } stop() { - echo -n "Shutting down Avahi daemon: " + echo -n $"Shutting down Avahi daemon: " $AVAHI_BIN -k RETVAL=$? + [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown" + rm -f $LOCKFILE echo return $RETVAL } reload() { - echo -n "Reloading Avahi daemon... " + echo -n $"Reloading Avahi daemon... " $AVAHI_BIN -r RETVAL=$? - [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup" + [ $RETVAL = 0 ] && success $"$base reload" || failure $"$base reload" echo return $RETVAL } - restart() { stop start @@ -67,7 +80,8 @@ case "$1" in ;; status) $AVAHI_BIN -c - [ $? = 0 ] && echo "Avahi daemon is running" || echo "Avahi daemon is not running" + RETVAL=$? + [ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running" ;; restart) restart @@ -76,12 +90,14 @@ case "$1" in reload ;; condrestart) - $AVAHI_BIN -c - [ $? = 0 ] && restart || : + if [ -f $LOCKFILE ]; then + restart + fi ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" exit 1 esac -exit $? +exit $RETVAL +