Welcome, guest! Login / Register - Why register?

Paste

N/A
Pasted as Bash by tinti ( 8 years ago )
#!/bin/sh

hosts=( 'your.host.tld' )
user='username'
pass_enc='password using base64'
lastipfile='/tmp/lastip'
pass=`echo $pass_enc | base64 -d`
myip=`dig a myip.opendns.com @resolver1.opendns.com +short`
lastip=`cat $lastipfile`

if [ "$myip" != "$lastip" ]; then
  for host in ${hosts[@]};
    do
      URL="https://dyndns.dns-stock.com/?hostname=$host&username;=$user&password;=$pass&myip;=$myip"
      wget -O /dev/null --quiet --no-check-certificate $URL
      echo $myip > $lastipfile
      touch $lastipfile
  done
else
  echo "IP did not change!" > /dev/null
fi

 

Revise this Paste

Children: 78615 101339
Your Name: Code Language: