1#! /bin/sh 2# 3### BEGIN INIT INFO 4# Provides: avahi 5# Required-Start: $network messagebus 6# Required-Stop: $network messagebus 7# Default-Start: 3 5 8# Description: Avahi, a ZeroConf daemon whichs implements an mDNS stack 9### END INIT INFO 10 11AVAHI_BIN=@sbindir@/avahi-daemon 12test -x $AVAHI_BIN || exit 5 13 14# Source function library. 15. /etc/init.d/functions 16 17. /etc/sysconfig/network 18 19# Check that networking is configured. 20[ "${NETWORKING}" = "no" ] && exit 0 21 22start() { 23 echo -n $"Starting Avahi daemon: " 24 $AVAHI_BIN -D 25 RETVAL=$? 26 if [ $RETVAL = 0 ]; then 27 touch /var/lock/subsys/avahi-daemon 28 success $"$base startup" 29 else 30 failure $"$base startup" 31 fi 32 echo 33 return $RETVAL 34} 35 36stop() { 37 echo -n "Shutting down Avahi daemon: " 38 $AVAHI_BIN -k 39 RETVAL=$? 40 if [ $RETVAL = 0 ]; then 41 rm -f /var/lock/subsys/avahi-daemon 42 success $"$base stop" 43 else 44 failure $"$base stop" 45 fi 46 echo 47 return $RETVAL 48} 49 50reload() { 51 echo -n "Reloading Avahi daemon: " 52 $AVAHI_BIN -r 53 RETVAL=$? 54 [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup" 55 echo 56 return $RETVAL 57} 58 59 60restart() { 61 stop 62 start 63} 64 65RETVAL=0 66 67# See how we were called. 68case "$1" in 69 start) 70 start 71 ;; 72 stop) 73 stop 74 ;; 75 status) 76 $AVAHI_BIN -c 77 [ $? = 0 ] && echo "Avahi daemon is running" || echo "Avahi daemon is not running" 78 ;; 79 restart) 80 restart 81 ;; 82 reload) 83 reload 84 ;; 85 condrestart) 86 $AVAHI_BIN -c 87 [ $? = 0 ] && restart || : 88 ;; 89 *) 90 echo $"Usage: $0 {start|stop|status|restart|condrestart}" 91 exit 1 92esac 93 94exit $? 95