Created
September 24, 2012 22:32
-
-
Save haad/3778862 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $1 ]; then | |
echo "ussage ping.sh destip" | |
exit -1; | |
fi | |
while (true);do | |
ping -qc 1 -w 1 $1 1>/dev/null | |
if [ $? -ne 0 ];then | |
echo -n "!" | |
echo "---- ERROR DUMP ----" >> /tmp/$1 | |
echo "`date` $1 unrechable" >> /tmp/$1 | |
arp -an | |
arping -f 192.168.10.10 -c 1 >> /tmp/$1 | |
arping -f 192.168.10.11 -c 1 >> /tmp/$1 | |
echo "Updating ARP caches on both switches" >> /tmp/$1 | |
arping -s 192.168.10.200 -U 192.168.10.10 -fc 1 >> /tmp/$1 | |
arping -s 192.168.10.200 -U 192.168.10.11 -fc 1 >> /tmp/$1 | |
echo "/---- ERROR DUMP ----/" >> /tmp/$1 | |
fi | |
echo -n "." | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment