I have a simple example I am trying to test it with, so I have the crontab calling a simple script that would blink an LED on and off when the raspberry pi connects to the internet after startup. However, it only works when I manually initiate the script not when I call it on the reboot in the crontab @reboot. However, my script does work on reboot with crontab if I don't ping the network first.
Here is the line of code in crontab
Here is the "StartupTest.py" script it is callingWhat am I missing?
Here is the line of code in crontab
Code:
@reboot python3 /home/pi/Documents/MBTAtests/StartupTest.py @Code:
#!/usr/bin/env python3import requestsimport timeimport gpiozeroled = gpiozero.LED(4)while True:response = requests.get('http://google.com')value = response.status_codeprint(response.status_code)if value == 200:led.on()time.sleep(1)led.off()time.sleep(1)Statistics: Posted by deri9928 — Mon Sep 30, 2024 3:34 am