22 May
2003
22 May
'03
18:15
* Jonas Piela (mailinglists@jonaspiela.de) [030522 10:50]:
I need some information on how to use checkproc in scripts to create a simple watchdog, that takes care of about fife services? I used "checkproc -p /var/run/named/named.pid /usr/sbin/named" to check if the bind is running, but how can i include this into a script executed by cron?
If checkproc exits non-zero then something is wrong. E.g., daemons="/usr/sbin/sshd /usr/sbin/named" for d in $daemons; do checkproc $d &>/dev/null || failed="$failed $d" done for failure in $failed; do echo | mail -s "$(hostname): $failure is not running" root done cron has a bad habit of dying under heavy load so I usually run something like the above in a loop instead of from cron. -- -ckm