#!/bin/sh
# $Id: sample-etc_rc.d_init.d_ddclient.redhat 2 2006-05-22 19:37:19Z wimpunk $
# ddclientd     This shell script takes care of starting and stopping
#               ddclient.
#
# chkconfig: 2345 65 35
# description: ddclient provides support for updating dynamic DNS services.

. /etc/rc.d/init.d/functions

SourceIfNotEmpty /etc/sysconfig/svnserve

PIDFILE=/var/run/ddclient/ddclient.pid
LOCKFILE=/var/lock/subsys/ddclient
CHECKTIME=60

# See how we were called.
case "$1" in
  start)
	# Start daemon.
        start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --user dyndns --expect-user dyndns  -- /usr/sbin/ddclient -daemon "$CHECKTIME" || failure
	;;
  stop)
	# Stop daemon.
	echo -n "Shutting down ddclient: "
	killall -9 ddclient && success && echo && rm -f "$LOCKFILE" && rm -f "$PIDFILE" || failure || echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  condrestart)
	if [ -e "$LOCKFILE" ]; then
	$0 restart
	fi
	;;
  status)
        status --pidfile "$PIDFILE" --expect-user dyndns --name ddclient -- /usr/sbin/ddclient
	;;
  *)
	echo "Usage: ddclientd {start|stop|restart|condrestart|status}"
	exit 1
esac

exit 0
