1#! /bin/sh 2# 3# avahi-dnsconfd: Starts the Avahi dns configuration daemon 4# 5# chkconfig: - 96 02 6# description: avahi-dnsconfd connects to a running avahi-daemon and runs the script \ 7# /etc/avahi/dnsconf.action for each unicast DNS server that is announced \ 8# on the local LAN. This is useful for configuring unicast DNS servers in \ 9# a DHCP-like fashion with mDNS. 10# processname: avahi-dnsconfd 11# config: 12 13AVAHI_BIN=@sbindir@/avahi-dnsconfd 14 15if [ "$1" = 'status' ]; then 16 test -x $AVAHI_BIN || exit 4 17else 18 test -x $AVAHI_BIN || exit 5 19fi 20 21OTHER_AVAHI_OPTS="" 22 23# Source function library. 24. /etc/init.d/functions 25. /etc/sysconfig/network 26 27LOCKFILE=/var/lock/subsys/avahi-dnsconfd 28 29base=${0##*/} 30 31start() { 32 # Check that networking is configured. 33 [ ${NETWORKING} = "no" ] && exit 1 34 35 echo -n $"Starting Avahi DNS daemon... " 36 $AVAHI_BIN -D 37 RETVAL=$? 38 if [ $RETVAL = 0 ]; then 39 touch $LOCKFILE 40 success $"$base startup" 41 else 42 failure $"$base startup" 43 fi 44 echo 45 return $RETVAL 46} 47 48stop() { 49 echo -n $"Shutting down Avahi DNS daemon: " 50 $AVAHI_BIN -k 51 RETVAL=$? 52 [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown" 53 rm -f $LOCKFILE 54 echo 55 return $RETVAL 56} 57 58reload() { 59 echo -n $"Reloading Avahi DNS daemon... " 60 $AVAHI_BIN -r 61 RETVAL=$? 62 [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup" 63 echo 64 return $RETVAL 65} 66 67restart() { 68 stop 69 start 70} 71 72RETVAL=0 73 74# See how we were called. 75case "$1" in 76 start) 77 start 78 ;; 79 stop) 80 stop 81 ;; 82 status) 83 $AVAHI_BIN -c 84 RETVAL=$? 85 [ $RETVAL = 0 ] && echo $"Avahi DNS daemon is running" || echo $"Avahi DNS daemon is not running" 86 ;; 87 restart) 88 restart 89 ;; 90 reload) 91 reload 92 ;; 93 condrestart) 94 if [ -f $LOCKFILE ]; then 95 restart 96 fi 97 ;; 98 *) 99 echo $"Usage: $0 {start|stop|status|restart|condrestart}" 100 exit 2 101 ;; 102esac 103 104exit $RETVAL 105