Hello all,

I am about to include about this script in my /etc/rc.local file

It logs me in to OpenDNS

Before I bore you with the script - which I found on the web - my question is:

How can I get it to produce an output in a log / text file so I can see what it did and if it was successful?

Here is the script:




UNAME=xxx               # username
PWORD=xxx               # password (plaintext, sorry!)
TEMP=/tmp/tmp.ddns      # temporary file
ERROR=5                 # times to retry

trap cleanup 1 2 3 6
cleanup()
{
   rm $TEMP
   exit 1
}

update()
{
wget --quiet --no-check-certificate -O $TEMP 'http://'$UNAME':'$PWORD'@updates.dnsomatic.com/nic/update?'

        if [ `cat $TEMP | grep -c good` = 1 ]
        then
                logger OpenDNS updated successfully
        else
                while [ $ERROR -gt 0 ]; do
                        ERROR=$(($ERROR-1))
                        sleep 10s
                        update
                done
                logger OpenDNS update failed
        fi
}

update
rm $TEMP
exit 0




I have tried to find a file called /tmp/tmp.ddns after running the script, but it is not there!


Thanks for your help


Ed

_______________________________________________
Peterboro mailing list
Peterboro@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/peterboro

Reply via email to