#!/bin/sh
#
# crond          Start/Stop the cron clock daemon.
#
# chkconfig:	2345 40 60
#
# description:	cron is a standard UNIX program that runs user-specified \
#		programs at periodic scheduled times. hc-cron adds a number \
#		of features to the basic UNIX cron, including better security \
#		and more powerful configuration options.
#
# processname:	crond
# config:	/etc/crontab
# pidfile:	/var/run/crond.pid


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

# Get service config
[ -f /etc/sysconfig/hc-cron ] && . /etc/sysconfig/hc-cron


# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/crond ]; then
		msg_starting Cron
		daemon crond
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond
	else
		msg_already_running Cron
		exit 1
	fi
	;;
  stop)
        # Stop daemons.
        if [ -f /var/lock/subsys/crond ]; then
                msg_stopping Cron
                killproc crond
                rm -f /var/lock/subsys/crond >/dev/null 2>&1
        else
                msg_not_running Cron
                exit 1
        fi
																	
	;;
  status)
	status crond
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	msg_usage "$0 {start|stop|status|restart}"
	exit 1
esac

exit $RETVAL
