#! /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. vixie cron adds a \
#		number of features to the basic UNIX cron, including better \
#		security and more powerful configuration options.
# description(es): cron es un programa UNIX patrn que ejecuta comandos \
#		especificados por el usuario a horas programadas. \
#		Vixie cron aade una serie de caractersticas al cron \
#		bsico, incluyendo seguridad mejorada y opciones de configuracin \
#		ms poderosas.
# description(pt_BR): cron  um programa UNIX padro que executa comandos \
#		especificados pelo usurio em horrios agendados. \
#		O Vixie cron adiciona uma srie de caractersticas ao cron \
#		bsico, incluindo segurana melhorada e opes de configurao \
#		mais poderosas.
# description(ru): cron -    UNIX ,  \
#		    . vixie cron \
#		   UNIX cron'  ,  \
#		      .
# description(uk): cron -    UNIX ,   \
#		Φ    . vixie cron \
#		   UNIX cron' צ æ,  \
#		Ц Φ  ¦ Φ æ Ʀæ.
#
# 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/cron ] && . /etc/sysconfig/cron

RETVAL=0
# 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 "Vixie cron"
		daemon crond </dev/null
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond
	else
		msg_already_running "Vixie cron"
	fi
	;;
  stop)
	if [ -f /var/lock/subsys/crond ]; then
		msg_stopping "Vixie cron"
		killproc crond
		rm -f /var/lock/subsys/crond
	else
		msg_not_running "Vixie cron"
	fi
	;;
  status)
	status crond
	exit $?
	;;
  restart)
	$0 stop
	$0 start
	exit $?
	;;
  reload|force-reload)
	if [ -f /var/lock/subsys/crond ]; then
		msg_reloading
		killproc crond -HUP
		RETVAL=$?
	else
		msg_not_running "Vixie cron" >&2
		exit 7
	fi
	;;
  *)
	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
	exit 3
esac

exit $RETVAL
