#!/bin/sh
#
# (C) Copyright 1993, 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
#
#
# Init script for Vixie cron.

. /etc/init.d/LIB

killall=`pathof killall /bin:/usr/bin`


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 cron /sbin:/etc/daemons:/etc:/usr/sbin:/usr/etc:/usr/daemons`
		if [ -n "$it" ]; then
			if $killall -0 cron 2> /dev/null; then
				: already running
			else
				$it
			fi
		fi
		;;

	stop)	# Yes crond saves its pid in /var/run/crond.pid but the file
		# is never deleted. Let's not start firing off kills
		# blindly and trusting to luck when we can do better...
		if wipeout cron; then
			echo "Cron stopped"
		else
			echo "Cron wasn't running"
		fi
		;;

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