I am trying to run the script below in a crontab to keep my ip upto date.
#!/bin/bash
clear
echo "my ip form opendns: "
dig @208.67.222.220 myip.opendns.com +short `hostname`
echo "----------------------------- "
echo ""
myips=$(dig @208.67.222.220 myip.opendns.com +short `hostname`)
arryIP=(${myips// / })
echo "should have found my IP address now: ${arryIP[0]}"
echo " "
echo "updating home.houseofhawkins.com: "
echo "----------------------------------"
curl https://www.cloudflare.com/api_json.html \
-d "a=rec_edit" \
-d "tkn=mycode" \
-d "id=myid" \
-d "email=myemail" \
-d "z=myzone" \
-d "name=home" \
-d "type=A" \
-d "content=${arryIP[0]}" \
-d "ttl=120"
echo ""
echo "done updating home.houseofhawkins.com..."
if I do
. /home/me/updateIp.sh
This script will run successfully, but if I put this into a crontab it will always fail:
*/1 * * * * . /home/jon/updateIp.sh >> /home/jon/updateIpScript.log
the log file will have:
my ip form opendns:
86.180.163.89
67.215.65.132
-----------------------------
Not sure what is wrong
asked
03 Mar '13, 12:14
twiggy
13●2
accept rate:
0%