Coding

Checking if a device is up using cron, ping and Zapier

Today I adapted a script from nixCraft to check if a device (in this case a Raspberry Pi) is up. The idea is simple: my computer should check every hour to figure out if the Raspberry Pi is still alive, and report to me if it isn’t.

Checking every hour is accomplished by the following crontab entry:

@hourly bash /home/wouter/bin/checkRasp3.sh

The bash script below pings my Raspberry Pi, and when ping was unsuccessful it will use a Zapier webhook to send me a Pushbullet notification to my phone and browser, although you could use the same idea to get a slack notification, an email,…

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s