I am trying to get my Raspberry Pi B+ to run a shell script everyday at the same time, and I am trying to use Crontab to do it. I run sudo crontab -e
to access my Crontab programs, and added the entry 21 16 * * * /home/pi/Documents/python/run.sh
which should have executed run.sh at 9:16pm everyday, if I read the documentation correctly, then saved the Crontab file.
The problem is, Crontab will not execute the program when 9:16pm rolls around. I have saved run.sh as an executable shell script, and it runs independently of Crontab (when I simply run it from anywhere as /home/pi/Documents/python/run.sh
, the program works as expected).
If it matters, the contents of the shell script are the following, which simply blink an LED on some GPIO pins. Again, the python script runs normally. I used full paths everywhere I could think to.
#!/bin/bash
clear
/usr/bin/python /home/pi/Documents/python/blinky11.py
The program blinky11.py has contents as follows, in case you think the problem lies there:
import RPi.GPIO as GPIO
import time
# blinking function
def blink(pin):
GPIO.output(pin,GPIO.HIGH)
time.sleep(1)
GPIO.output(pin,GPIO.LOW)
time.sleep(1)
return
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel
GPIO.setup(11, GPIO.OUT)
# blink GPIO17 50 times
for i in range(0,550):
blink(11)
GPIO.cleanup()
Any help appreciated!
P.S. I also tried restarting Cron with sudo service cron restart
and still no dice.