Simple cron init.d status checker

Simple cron script to check the status of some init.d daemon/script and restart it if necessary, shown in the example with postgresql, but should work with about any init.d script.

#!/bin/sh

SCRIPT=postgresql

/etc/init.d/$SCRIPT status
if [ "$?" != "0" ]; then

 /etc/init.d/$SCRIPT start

fi

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.