#!/bin/sh
#
# cfengine        starts cfd
#
#
# chkconfig: 345 50 50
# description: cfengine is used for receiving commands from cfrun on \
# a remote system.

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

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

RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting cfengine: "
	# we don't want the MARK ticks
	daemon cfd -f /etc/cfd.conf
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cfengine
	;;
  stop)
	echo -n "Shutting down cfengine: "
	killproc cfd
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cfengine
	;;
  status)
	status cfd
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	echo "Usage: cfengine {start|stop|status|restart}"
	exit 1
esac

exit $RETVAL

