GeekGoneCrazy Posted March 23, 2011 Share Posted March 23, 2011 (edited) Hello again all, Looking for some assistance with a bash script I wrote. Its throwing some odd errors, and doesn't seem to be working correctly. Errors are in my loop and if statement. Shows the content of the variable and says command not found. I'm not executing a command... I'm comparing variables. I don't get it. Any pretty much any other language i've ever used this would be valid. Related to my topic about network setup. Its suppose to initially grab my public ip. Then every 30 minutes check and make sure the ip hasn't changed. If so update via a POST https://gist.github.com/882540 #!/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 Any ideas? Thanks, Edited March 23, 2011 by GeekGoneCrazy Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.