Subject: Re: bin/10775: cron exits on stat failure
To: Robert Elz <kre@munnari.OZ.AU>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 08/09/2000 17:42:49
>On one of my systems I have (in /etc/rc - it is a 1.4.1 system, predates
>the rc.d stuff) ...
>
>if checkyesno cron; then
> echo -n ' cron'; cron
> ( while :
> do
> sleep 77
> if [ `ps axc | grep -i cron | wc -l` -lt 1 ]
> then
> logger -p cron.notice -t CRON_RESTART "restarting cron"
> cron
> fi
> done & )
>fi
>echo '.'
actually...to combat this problem (i saw it once or twice) i wrote a
cron job to check if cron was running, and if not to restart it. it
runs once every five minutes. if cron was dead, i get email and it
gets restarted.
#!/bin/sh
sleep 360
read pid < /var/run/cron.pid
if kill -0 $pid >/dev/null 2>&1; then
exit 0
else
cron
echo cron was dead
fi
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."