I tried your cronmonitor script - and it "did what it says on the tin"

However, whenever I restarted the machine although the crond appeared in the "ps" list the /var/.cron_running file wasnt being touched (nor was my other 1 min script being run).
Having "fiddled about a bit" it seems that crond hates anyone processing the cron file while it is running ... so now I copy /etc/cron/root to root.crontab at startup and edit that and have cronmon test that, halt crond, move copy.crontab to root and restart crond.
- Code: Select all
#!/bin/sh
. /etc/.language
. /etc/$DLANG.cch
# It seems that CROND really *HATES* anyone touching the cron file
# while its running
if [ ! -f /etc/cron/root.crontab ]
then rc_crond stop
cp /etc/cron/root /etc/cron/root.crontab
sync
rc_crond start
fi
set -- `ls -l /etc/cron/root.crontab`
OLD=$5$8
while :
do set -- `ls -l /etc/cron/root.crontab`
CURRENT=$5$8
if [ $CURRENT != $OLD ]
then rc_crond stop
rm /etc/cron/root
cp /etc/cron/root.crontab /etc/cron/root
cp /etc/cron/root /boot/etc/cron.cfg
sync
OLD=$CURRENT
echo "Updated OK" >/var/cronmon.log
rc_crond start
fi
sleep 30
done
This seems much better, but I still find crond gets stuck as before on a system reboot, though doing a rc_crond restart seems to poke it back into life.
Any ideas as to how I can make it 100% reliable??
Bob