For a short time you have to, so that one does not lose its host name, log in your account every month of DynDNS.org. With a simple script and a crontab entry allows you to automate.
Log on automatically
This script automates the login account of the DynDNS.org. You must enter the user name and password only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#!/bin/bash ######################################################################## # # dyndnslogin # Automate login to prevent account expiration # ####################################################################### ######################################################################## # DynDNS Settings USERNAME="username" PASSWORD="password" ######################################################################## # Variabeln PROGNAME=dyndnslogin COOKIE=`mktemp --tmpdir="/tmp" -t ${PROGNAME}_cookie_***XXXX` OUTPUT=`mktemp --tmpdir="/tmp" -t ${PROGNAME}_output_***XXXX` USERAGENT="Mozilla/5.0" ######################################################################## # Main MULTIFORM=`curl -s -k -A $USERAGENT -c $COOKIE https://account.dyn.com \ | awk -F\' '/multiform/{ print $6 }'` curl -s -k --location -A "$USERAGENT" -b $COOKIE -c $COOKIE -o $OUTPUT \--data "username=$USERNAME&password=$PASSWORD&iov_id=&sub mit=Log+in&multiform=$MULTIFORM" \https://account.dyn.com/ if grep -E "(Welcome|Hi).*$USERNAME" $OUTPUT > /dev/null 2>&1 then echo Login successful else echo Login failed FAILED="true" fi rm $COOKIE rm $OUTPUT if [ "$FAILED" = "true" ] then exit 1 fi # EOF |
After running to get the feedback on whether the login has worked or not.
Automate
With crontab-e to edit your crontab and add there the following line:
1 |
5 23 * * 0 /usr/local/bin/dyndnslogin |
Thus, an account Log in DynDNS.org is made every Sunday at 23:05.
source:http://emanuelduss.ch/
Thanks!, I really needed this as I have been a free user of DynDNS for a long time.
However i get the following error:
curl: no URL specified!
curl: try ‘curl –help’ or ‘curl –manual’ for more information
DynDNS.sh: line 30: https://account.dyn.com/: No such file or directory
Login failed
Any Ideas?
Im running Ubuntu Server 12.04.
Thanks.
This script works great. One thing to be aware of:
On the line that begins ‘MULTIFORM’, either add a linefeed between the ‘\’ and the ‘|’ before awk, or delete the ‘\’. Treat the ‘\’ characters the same on the line that begins with ‘curl’.
See the source as metioned below the article. You’ll see what I mean. It’s in German so load it up in Google Translate if you need to, but the code is in English. 🙂 http://emanuelduss.ch/2013/05/zwingender-monatlicher-login-bei-dyndns-org-automatisieren/
It works flawlessly for me after fixing that. The line feeds must have gotten lost when the blogger pasted in the code.
Great work!
Thanks Guys. I have updated the post and the link as well
Thank you much for the script. If anybody wants to run this on OSX (or any other *nix system that doesn’t have mktemp, you can modify the Variable section to the following:
# Variabeln
PROGNAME=dyndnslogin
DSTAMP=`date “+%Y%m%d%H%M%S”`
COOKIE=”/tmp/${PROGNAME}_cookie_${DSTAMP}”
OUTPUT=”/tmp/${PROGNAME}_output_${DSTAMP}”
USERAGENT=”Mozilla/5.0″
Thanks for this.
I found that I needed to specify my username in lowercase or change the “grep -E” command to “grep -E -i” to deal with a mixed case username specified at the top of the script.
Hi
Thanks for the comment. You are right “-i” will search for mixed case username
Thanks
I’ve tried to set something up like this in the past but didn’t have any luck (was using a different script). However, this one works great!
I didn’t use mktemp because my environment (consumer NAS: DNS-323) has a different version of mktemp and I couldn’t figure out the proper usage. Brian’s comment solved that issue.
Thanks a bunch.
I am afraid 30 days from now Dyn will end the free hostname program. They are offering a 25% discount for upgrading to VIP status. More info below:
http://dyn.com/blog/why-we-decided-to-stop-offering-free-accounts/