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

Re: ping script



On Fri, Jan 16, 2004 at 10:23:57PM -0800, Curtis Vaughan wrote:
> 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?

#!/bin/sh
while :; do
  # Allow for intermittent network failures
  ping -c 120 "$1" && LAST="`date -R`" || \
  	mail -s "Can't ping $1 since $LAST" < /dev/null
done

-- 
Jan Minar                   "Please don't CC me, I'm subscribed." x 9

Attachment: pgpgPgELDq6nd.pgp
Description: PGP signature


Reply to: