Bash script update he ipv6 tunnel info
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/bash | |
# | |
#Script to update ip on Hurricane Electric every 30 minutes | |
#@author Aaron Ogle | |
#Variables | |
HE_userid=<userid> | |
HE_passwd=<passwordhash> #echo -n "yourpassword" | md5sum | |
HE_tunnelid=<tunnelid> | |
#Tossing it in a function | |
updateip() { | |
#Loop to keep IP updated | |
while [ true ] | |
do | |
#Get Current IP. | |
NewIP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//') | |
if [ "$OldIP" != "$NewIP" ] | |
then | |
curl -k -s "https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=AUTO&pass=$HE_passwd&user_id=$HE_userid&tunnel_id=$HE_tunnelid" > /dev/null | |
echo 'Updated IP:'$NewIP | |
else | |
echo 'Unchanged' | |
fi | |
#Sleep for 30 Minutes | |
OldIP="$NewIP" | |
sleep 1800 | |
done | |
} | |
#Calling it. This is done so it can be added to the startup. | |
updateip & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment