Created
July 31, 2016 00:11
-
-
Save dimitrovs/992d7e5e748f59af960084fd6531740d to your computer and use it in GitHub Desktop.
Script to update IPv6 tunnel when IPv4 changes
This file contains 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
0,15,30,45 * * * * sh *full path to script here*/*scriptnamehere*.sh &>/dev/null |
This file contains 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/sh | |
HE_URL="" | |
ip1="" | |
ip2="" | |
read ip1 < ip.txt | |
ip2=$(wget -qO- ifconfig.me/ip) | |
if [ "$ip1" = "$ip2" ] | |
then | |
exit | |
else | |
echo "$ip2" > ip.txt | |
wget -qO /dev/null "$HE_URL" | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment