I cannot get a cron task to run in linux on a Rpi.
I’m logged in as user ‘pi’ and used the command
crontab -e
to create the file
*/1 * * * * /home/pi/cron_scripts/nettask
To run once per minute
Then, I created a file in /home/pi/cron_scripts called nettask
I made the file executable with ‘sudo chmod +x nettask’
nettask is a file with the contents:
#!/bin/bash
ping -c 1 -q 8.8.8.8
if [ “$?” -eq 0 1 ]; then
printf “%s\n” “SUCCESS”
else
printf “%s\n” “FAIL”
fi
exit 0
But it does not run. Why?
I will eventually replace the text messages (SUCCESS/FAIL) with a Python script to drive a GPIO pin high or low to turn a LED on or off depending on whether or not there is a network connection.