#!/bin/bash
#
# dhid            This shell script takes care of starting and stopping
#                 dhid (Dynamic Host Information System client).
#
# chkconfig: 345 50 50
# description: dhid is a Dynamic Host Information System (DHIS) server \
# that is used to subscribe host IP addresses into DNS dynamically.
# processname: dhid
# config: /etc/dhid.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

[ -f /usr/sbin/dhid ] || exit 0

[ -f /etc/dhid.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
	start)
        	echo -n "Starting dhid: "
        	daemon dhid
		RETVAL=$?
		echo
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhid
		;;
	stop)
        	echo -n "Shutting down dhid: "
        	killproc dhid
		RETVAL=$?
        	echo
		[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhid
		;;
	status)
        	status dhid
		RETVAL=$?
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload)
		killall -HUP dhid
		RETVAL=$?
		;;
	*)
        	echo "Usage: dhid {start|stop|status|restart|reload}"
		exit 1
esac

exit $?

