Skip to content

Instantly share code, notes, and snippets.

@haad
Created September 24, 2012 22:32
Show Gist options
  • Save haad/3778862 to your computer and use it in GitHub Desktop.
Save haad/3778862 to your computer and use it in GitHub Desktop.
#!/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