[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ping script



Curtis Vaughan said:
> Has anyone written a script that they're willing to share that pings a
> host and when the ping fails it send out an email message?
>
> Could you share it with me?

Here's a quick one:
#!/bin/bash
if ping -c 1 $1;
then echo "success";
else echo "ping failed for $1" | mail -s "ping failure for $1" bijan@psq.com;
fi

Simply replace "bijan@psq.com" with your email address.

Bijan
-- 
Bijan Soleymani <bijan@psq.com>
http://www.crasseux.com



Reply to: