The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-10-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,805
How are you going to fire off or schedule a check on crond ( the cron daemon) if it is not running? at, batch, and crontab all depend on the crond process being up, happy, and working.

A possibility is to look thru the process list every hour with a permanently running process. This is not a great idea but you could try something like this:


Code:
while true
do
   sleep 3600   # one hour
   ps -ef > /tmp/t.lis
   grep -q 'crond' /tmp/t.lis || echo 'crond is down' | /usr/bin/mailx -s 'crond is down'  me@my.com
done

Then logon and start the script nohup as a background process. But then you have the problem later on: is this process still working? And this script does not tell you if there might be something else going on, like your crontab has syntax errors or the syadmin turned of crontab access for your account.

Sometimes having a proactive sysadmin with the right toolset is the best choice - hacks like this come in a distant second.