Mandatory monthly Login with DynDNS.org automate (auto login script)

por | 17 julio, 2013

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.

#!/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:

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/

Categoría: Nix