Answers to: Running bash file in sudo crontab seems to failhttp://linuxexchange.org/questions/3053/running-bash-file-in-sudo-crontab-seems-to-fail<p>I am trying to run the script below in a crontab to keep my ip upto date.</p> <pre><code>#!/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 <a href="https://www.cloudflare.com/api_json.html">https://www.cloudflare.com/api_json.html</a> \ -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" </code></pre> <p>echo "" echo "done updating home.houseofhawkins.com..."</p> <p>if I do </p> <pre><code>. /home/me/updateIp.sh </code></pre> <p>This script will run successfully, but if I put this into a crontab it will always fail:</p> <pre><code>*/1 * * * * . /home/jon/updateIp.sh &gt;&gt; /home/jon/updateIpScript.log </code></pre> <p>the log file will have:</p> <pre><code>my ip form opendns: 86.180.163.89 67.215.65.132 ----------------------------- </code></pre> <p>Not sure what is wrong</p>enSun, 03 Mar 2013 20:19:56 -0500Answer by rfelsburghttp://linuxexchange.org/questions/3053/running-bash-file-in-sudo-crontab-seems-to-fail/3057<p>First thing first, put a bash -x in front of the cron entry for the command, see exactly where it's failing. Also remove the dot in front.</p> <p>so:</p> <pre><code>*/1 * * * * bash -x /home/jon/updateIp.sh &gt;&gt; /home/jon/updateIpScript.log </code></pre> <p>Post said output.</p>rfelsburgSun, 03 Mar 2013 20:19:56 -0500http://linuxexchange.org/questions/3053/running-bash-file-in-sudo-crontab-seems-to-fail/3057