I have a script I just created which runs fine under root. I added a cron job but it doesn't run right
Commands are:
gpio -g mode 17 input getval="$(gpio read 17)" todayis=$(date) getstatus=$getval if [ "$getstatus" = "0" ]; then power="Power ON" else power="Power OFF" echo $todayis $power $getstatus >> /var/www/turnmeon.log Log file when run as root:
Wed Nov 8 21:11:41 UTC 2017 Power ON 0 Log file when run as crontab:
Wed Nov 8 21:11:41 UTC 2017 Power OFF There is no 1 at the end like I might expect if OFF really was true.
Why would it run under a bash prompt but not as a crontab job
*/2 * * * * bash /myscript.sh