Since ddclient is supposed to work with FreeDNS, but is not *actually* working on Ubuntu, changed to dnsactual.sh from afraid.org unix client listings.
Since there's no .deb, had to hack it.
location: /usr/local/bin
schedule: root crontab every minute
TOKEN="YOU WISH :-)"
PATH=/bin:/sbin:/usr/bin:/usr/sbin
IFACE=[PUBLIC-IF]
if test -f /etc/freedns/dnsactual.conf
then
CacheIP=$(cat /etc/freedns/dnsactual.conf)
fi
CurreIP=$(ifconfig $IFACE | grep -oEe "addr:[0-9\.]*" | cut -f 2 -d :)
if [ "$CurreIP" = "$CacheIP" ]
then
# Both IP are equal
echo "Update not required..."
else
# The IP has change
echo "Updating http://free.afraid.org with " $CurreIP
wget http://freedns.afraid.org/dynamic/update.php?$TOKEN -o /dev/null -O /dev/stdout
echo `date` "Updating log with IP " $CurreIP >> /var/log/dnsactual.log
fi
rm -f /etc/freedns/dnsactual.conf
echo $CurreIP > /etc/freedns/dnsactual.conf
Configs or settings that were hard to find, or messy in getting to... for future personal reference.
Showing posts with label scripts. Show all posts
Showing posts with label scripts. Show all posts
Monday, January 3, 2011
Friday, June 24, 2005
DOS shell command output to %VAR%
In Linux its quite easy to get the output of a command into a variable for future use. In Windows..., well, no quite so easy.
FOR /F %%B IN ('d:\utils\date +%%Y%%m%%d-%%H%%M') DO SET DATE=%%B
The 'date' command in this examples is the Win32 GNU port of the equivalent Linux command.
For use in CMD or BAT scripts in Windows.
FOR /F %%B IN ('d:\utils\date +%%Y%%m%%d-%%H%%M') DO SET DATE=%%B
The 'date' command in this examples is the Win32 GNU port of the equivalent Linux command.
For use in CMD or BAT scripts in Windows.
Subscribe to:
Posts (Atom)