#!/bin/ksh # cron_check.ksh CPID=`ps -ef | egrep 'cron' | head -1 | sed '/ /s// /g' | sed '/ /s// /g' | sed '/$ /s///g' | cut -d' ' -f 3` if [ $CPID ]; then echo "The pid of cron is $CPID ... so cron is running okay at `date`" else echo "Need to fix cron at `date` ... running 'sudo cron restart' ..." sudo cron restart fi NEXT=`at now + 1 minutes < $0` echo $NEXT exit