#!/bin/sh
#
# dcd		This shell script takes care of starting and stopping DConnect Daemon
#
# chkconfig:	2345 91 35
# description:	D****ct Connect Hub running in daemon mode
# processname:	dcd
#
# pidfile:	/var/run/dcd.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
if is_no "${NETWORKING}"; then
	msg_network_down dcd
	exit 1
fi

# Try get config..
[ -f /etc/sysconfig/dcd ] && . /etc/sysconfig/dcd

# See how we were called.
case "$1" in
	start)
		# Start daemons.
		if [ ! -f /var/lock/subsys/dcd ]; then
			msg_starting dcd
			daemon dcd $OPTIONS 
			RETVAL=$?
			[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dcd
		else
			msg_already_running dcd
		fi
		;;
	stop)
		# Stop daemons.
		if [ -f /var/lock/subsys/dcd ]; then
			msg_stopping dcd
			killproc dcd
			rm -f /var/lock/subsys/dcd >/dev/null 2>&1
		else
			msg_not_running dcd
			exit 1
		fi
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload)
		if [ -f /var/lock/subsys/dcd ]; then
			msg_reloading dcd
			busy
			killproc dcd -HUP
		else
			msg_not_running dcd
			exit 1
		fi
		;;
	status)
		status dcd
		;;
	*)
		msg_usage "$0 {start|stop|restart|status}"
		exit 1
esac

