linuxbashmonit

Can I set up something to monitor Cron JOb/script


Can I set up something to monitor Cron Job, a script running and if it fails it should restart the script and alert us? for the failure it may have to check the logs for keywords?


Solution

  • Instead of using a cron job you can use a similar function in monit and evaluate the return code. The monit will send a mail if the status fail. For some additional information see https://www.mmonit.com/monit/documentation/monit.html#SERVICE-POLL-TIME

    The monit program can not monitor the executed cron jobs. If error messages are written to a log file monit can use the messages to send a mail.