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?

asked Jul 23, 2014 at 19:34
3
  • Have you looked at this raspberrypi.org/forums/viewtopic.php?f=31&t=43509 Commented 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. Commented Jul 23, 2014 at 22:43
  • 1
    What is the exact error? Commented Jul 23, 2014 at 22:44

1 Answer 1

1

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.

answered Jul 24, 2014 at 6:25
3
  • don't I need to do a chmod on the script as well to make it executable? Commented 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 Commented Jul 24, 2014 at 14:41
  • well, set the environment variable DISPLAY and it will run perfectly Commented Jul 24, 2014 at 16:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.