#!/bin/sh
#
# $Id: cron,v 4.1 1993/03/23 16:17:09 mike Exp $
#
# Init script for Vixie cron.

. /etc/init.d/LIB

case "$1" in
	start)	# If we can find a crond out there and it doesn't seem
		# to be running at the moment then fire it up.
		it=`pathof crond /etc:/etc/daemons:/usr/daemons`
		if [ -n "$it" ]; then
			if [ -z "`pidof crond`" ]; then
				$it
			fi
		fi
		;;

	stop)	# Yes crond saves its pid in /etc/crond.pid but the file
		# is never deleted. We use ps to find every instance of
		# a running crond and kill them.
		pidof crond | while read pid
		do
			kill $pid
		done
		;;

	*)	echo "usage: cron start|stop"
		exit 1
		;;
esac
