Hello,
I was writing a script to check if wan ip address changed or not, if changed update the new ip to ddns and letting it run in cron. I saw different behaviors when the script is executed normal and in cron.
To explain the issue better plesae see below code snippet,When this script executed as normal (./script.sh) It will print "same" to /home/pi/test.log. If the script is executed in cron as below,Then it writes "notsame" to /home/pi/test.log .
I tested this in different raspberry pi versions in bash and every where same problem. All running raspbian latest.
Any thoughts?
I was writing a script to check if wan ip address changed or not, if changed update the new ip to ddns and letting it run in cron. I saw different behaviors when the script is executed normal and in cron.
To explain the issue better plesae see below code snippet,
Code:
var1="a"var2="a"if [ "$var1" == "$var2" ]; then echo "same" >> /home/pi/test.logelse echo "notsame" >> /home/pi/test.logfi
Code:
*/1 * * * * /home/pi/script.sh
I tested this in different raspberry pi versions in bash and every where same problem. All running raspbian latest.
Any thoughts?
Statistics: Posted by sim_tcr — Fri Nov 22, 2024 5:13 am — Replies 4 — Views 64