#!/bin/sh # # ddclient This shell script takes care of starting and stopping ddclient. # # chkconfig: - 65 35 # description: ddclient provides support for updating dynamic DNS services # processname: ddclient # config: /etc/sysconfig/ddclient # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 . /etc/sysconfig/ddclient exec="/usr/sbin/ddclient" prog=$(basename $exec) lockfile=/var/lock/subsys/$prog cache=/var/cache/ddclient/ddclient.cache pid=/var/run/ddclient/ddclient.pid start() { echo -n $"Starting $prog: " [ -f $cache ] || touch $cache chown ddclient:ddclient $cache && chmod 600 $cache || exit $? daemon --user=ddclient --pidfile=$pid $exec $DDCLIENT_OPTIONS retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " # FIXME: call killproc with -p $pid; not done yet so that a 3.6.6->3.7.1 # update will do the right thing with try-restart during the upgrade killproc $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { stop start } reload() { restart } force_reload() { restart } # See how we were called. case "$1" in start|stop|restart|reload) $1 ;; force-reload) force_reload ;; status) status -p $pid $prog ;; try-restart|condrestart) [ ! -f $lockfile ] || restart ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}" exit 2 esac