0

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?

0

you should do approximately this:

  1. crontab -e, add a line

    @reboot /home/pi/bash_script

  2. 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? – Bachalo Jul 24 '14 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 – Bachalo Jul 24 '14 at 14:41
  • well, set the environment variable DISPLAY and it will run perfectly – lenik Jul 24 '14 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.