... dedicated to the pursuit of making money!

 

Script To Ping Hosts

February 04, 2007

It never fails. A server goes down and you don’t find out about it until days later. Put this script on one of your reliable *nix hosts and never worry again…

 

#!/bin/bash

 

#########################################

# Script to make sure hosts are

# still up. Enjoy!

# Replace ip#1 & ip#2 with your IP’s

# Replace your@email.com with your email

##########################################

 

#Ping host one

ping ip#1 -c 3

if [ $? -ne 0 ]

then

# Email Me

/bin/mail -s “Host1 Test Failed” your@email.com < .

fi

 

#Ping host two

ping ip#2 -c 3

if [ $? -ne 0 ]

then

# Email Me

/bin/mail -s "Host2 Test Failed" you@email.com < .

fi

 

 

What the future has in store

You can expect this site to change fairly regularly (probably a least once per week). I will be using it mostly as a way to centrally house my ideas and as a way to test new and/or exciting projects that I happen to be working on. If you'd like to see something on this site or have any sort of feedback please feel free to contact me.