Last active
August 29, 2015 14:02
-
-
Save benoitjpnet/14cb46e4d97ca9071c27 to your computer and use it in GitHub Desktop.
online IPv6 sucks :(
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 | |
# Relaunch dhclient when it crash... | |
mailaddr="[email protected]" | |
IPv6=true | |
pgrep -f dhclient6 > /dev/null | |
status=$? | |
if [[ $status != 0 ]]; then | |
IPv6=false | |
fi | |
ping6 -q -c1 free.fr > /dev/null | |
status=$? | |
if [[ $status != 0 ]]; then | |
IPv6=false | |
fi | |
if [[ $IPv6 == false ]]; then | |
echo "IPv6 not functional, relaunched dhclient6!" \ | |
| mail -s "Dhclient for IPv6 relaunched on $(hostname -f)" $mailaddr | |
/sbin/ifdown eth0 | |
pkill -9 -f dhclient6 > /dev/null | |
/sbin/ifup eth0 | |
ping6 -q -c1 free.fr > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment