The UPS on my production server has flaked out; it’s still giving surge protection, but the battery backup is gone. So, while I’m waiting on a new UPS, I need to monitor the box so I know it’s still up. But I don’t want to hang around the office all weekend. The solution lay in 5 lines of Bourne shell code:
while ping server
do
sleep 3600
done
/usr/lib/sendmail hboswell@kudzufiles.com < mail_msg
This will ping the server every hour; if it's up, it just goes back to sleep. If it's down, it exits the while loop and fires off an email. Simple and effective.
No argument here. Of course you could do this with Java, VB or some other code as well (not in 5 lines).