#!/bin/bash # # dnsupdate This shell script takes care of starting and stopping # dnsupdate. # # chkconfig: 2345 56 44 # description: dnsupdate is an automatic IP address updater as defined \ # in RFC2136. It is used to submits dynamic IP address update \ # requests to a name server automatically. # pidfile: /var/run/dnsupdate.pid # config: /etc/dnsupdate/dnsupdate.conf # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 # Source dnsupdate configureation. if [ -f /etc/sysconfig/dnsupdate ]; then . /etc/sysconfig/dnsupdate else INTERVAL=3600 fi dnsupdate=/usr/bin/dnsupdate config=/etc/dnsupdate/dnsupdate.conf [ -f $dnsupdate ] || exit 0 [ -f $config ] || exit 0 RETVAL=0 prog=dnsupdate start() { # Start daemons. if [ -f "/var/run/dnsupdate.pid" ]; then echo -n $"$prog: already running" echo return 1 fi $dnsupdate --daemon $INTERVAL $OPTIONS RETVAL=$? if [ $RETVAL -eq 0 ]; then action $"Starting $prog: " /bin/true else action $"Starting $prog: " /bin/false fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dnsupdate return $RETVAL } stop() { # Stop daemons. echo -n $"Stopping $prog: " killproc $dnsupdate RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsupdate /var/run/dnsupdate.pid } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $dnsupdate RETVAL=$? ;; restart) restart ;; condrestart) [ -f /var/run/dnsupdate.pid ] && restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" exit 1 esac exit $?