Server alerts via SMS

There was a server recently, that I used regularly, that I noticed kept going down in the middle of the night every Friday. Since I was fairly annoyed at not being able to check the websites hosted on the server on the weekends, and not able to check the exact time the server went down, I devised a little script that checked the server for me.

This script uses o2SMS, which can send via Meteor, o2, 3Ireland, and Vodafone to send me a text when the server has not responding to ping.

while ping -W 1 -c 1 $IPADDRESS 2>&1 >/dev/null; do true; done && echo “Server is down” | meteorsms me

This job was ran in screen all week, and at 04:23 on Friday I got a text saying the server had gone down.

The inverse of the command was ran in a screen, which text me when the server was back up.

while ! ping -W 1 -c 1 $IPADDRESS 2>&1 >/dev/null; do true; done && echo “Server is up” | meteorsms me