Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- HOSTS=”192.168.1.1 192.168.1.251 google.com 192.168.1.7“
- COUNT=4
- for myHost in $HOSTS
- do
- count=$(ping -c $COUNT $myHost | grep ‘received‘ | awk -F’,’ ‘{ print $2 }’ | awk ‘{ print $1 }’)
- if [ $count -eq 0 ] ; then
- # 100% failed
- echo -e “Subject: $myHost is down\r\n\n Aww , Snap.. $myHost is down” |msmtp –from=default -t dest.addr@gmail.com
- fi
- done
- #-EOF
- Visit : www.techrapid.co.uk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement