Created
March 23, 2011 02:59
-
-
Save geekgonecrazy/882540 to your computer and use it in GitHub Desktop.
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=<password hash> | |
HE_tunnelid=<tunnelid> | |
#Get current ip. | |
CurrentIP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//') | |
#Initial update to services | |
echo ***Starting update script*** | |
HE_updateparms='ipv4b='$CurrentIP'&user_id='$HE_userid'&pass='$HE_passwd'&tunnel_id='$HE_tunnelid | |
curl -F $HE_updateparms http://ipv4.tunnelbroker.net/ipv4_end.php | |
echo 'Ip set:'$CurrentIP | |
#Loop to keep time updated | |
address='dynamic' | |
until [$address -eq 'static']; | |
do | |
#Get Current IP again. | |
IP=$(curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.$//') | |
if ["$CurrentIP" != "$IP"]; | |
then | |
#Could use AUTO instead of passing. But were've already got it. | |
#Might as well pass it | |
curl -F $HE_updateparms http://ipv4.tunnelbroker.net/ipv4_end.php | |
echo 'Updated IP:'$IP | |
else | |
echo 'Unchanged.' | |
fi | |
#Sleep for 30 Minutes | |
sleep 1800 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment