diff --git a/scripts/watchdog_monitord.sh b/scripts/watchdog_monitord.sh new file mode 100644 index 0000000..1acf2d2 --- /dev/null +++ b/scripts/watchdog_monitord.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# watchdog script for monitord +# add this script to your crontab by using `crontab -e` + +# "monitord status" returns 0 if it is not running +/etc/init.d/monitord status >> /dev/null + + +# try to restart +if [ $? -ne 0 ] +then + echo "not running... trying to restart" + /etc/init.d/monitord start + + if [ $? -ne 0 ] + then + echo "failed!" + fi +fi +