I tried simply editing the autostart file to run a Python script on boot, but it runs with errors, I assume becasue the desktop hasn't completed. Can someone tell me how I would launch a script with a delay?
-
Have you looked at this raspberrypi.org/forums/viewtopic.php?f=31&t=43509– Steve RobillardCommented Jul 23, 2014 at 19:42
-
Yes, It works partially as mentioned in my post, but pretty sure I need a delay BEFORE I execute my script.– BachaloCommented Jul 23, 2014 at 22:43
-
1What is the exact error?– Steve RobillardCommented Jul 23, 2014 at 22:44
Add a comment
|
1 Answer
you should do approximately this:
crontab -e
, add a line@reboot /home/pi/bash_script
inside the bash script write the following
#!/bin/bash
/bin/sleep 100 && /usr/bin/python /home/pi/blah.py
where blah.py
is your script you want to run with a delay.
-
don't I need to do a chmod on the script as well to make it executable?– BachaloCommented Jul 24, 2014 at 14:28
-
ok, I have another issue with tKinter, if I simply run my script from LXTerminal it works, but if called via a cron job get _tkinter.TclError: no display name and no $DISPLAY environment variable– BachaloCommented Jul 24, 2014 at 14:41
-
well, set the environment variable DISPLAY and it will run perfectly– lenikCommented Jul 24, 2014 at 16:23