Reputation: 442
I tried using cron
to start python script , at boot (as mentioned in the link).Running a python script At Boot using cron
I made a python script "hello.py"
:
#!usr/bin/env python
import time
print "Hello World!"
time.sleep(10)
Then chmod +x hello.py
.
I checked,if it running or not,it is giving me output.
I used crontab -e
command and added the line @reboot python /home/pi/hello.py &
.
Reboot using sudo reboot
, but nothing happened! I am newbie .Although I read many discussions but I am not able to fix that!
Upvotes: 0
Views: 1688
Reputation: 7335
Generally when I want to verify whether a cronjob ran or not, I redirect all output to a log file like so:
12 0 * * * python /Path/To/File.py > /Path/ToLog/log 2>&1
Then you can check this log timestamp and for its contents
Upvotes: 1