tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Start at boot

Mon Jul 17, 2017 1:17 pm

Hi, I just start playing with Pi and Linux. I am still explorering all the available built in features.

I wrote a python script, now I like it to be able to run when the Pi boot up.
Is there a setting anywhere in Raspbian Jessise ( the lates OS from this site.) to turn on this feature or I need to sonfigure the system to do it? Is so what do I need to modify? Thanks.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Start at boot

Mon Jul 17, 2017 1:20 pm

Yes, there are several options.
Does your script use GUI or text output that you need to see?
Or can it just run quietly in the background?

tony1812
Posts: 354
Joined: Sat Jul 15, 2017 12:40 pm
Location: Boston MA.

Re: Start at boot

Mon Jul 17, 2017 2:26 pm

Thank you for the reply.

The script was written on TextWrangler on Mac saved as .py, then trans to the Pi. Then it was run on the Pi in Python 2 (IDEL.) manually at this point.

So now on the Pi is a .py file.

If it can be seen in th GUI it is nice but not a must. If it can also just sits in the background and do it's tasks quitely after everytime the Pi is rebooted. https://www.raspberrypi.org/forums/post ... 1&t=188522#

AndrewPiB
Posts: 11
Joined: Sun Dec 25, 2016 5:01 pm

Re: Start at boot

Mon Jul 17, 2017 3:39 pm

For my python script I added a line to /etc/profile

sudo python /home/pi/glc.py &

The & is very important as the pi will stop on that script without it.

Andrew

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Start at boot

Mon Jul 17, 2017 3:48 pm

Some other options:
* use cron with @reboot
* use systemd service. http://www.raspberrypi-spy.co.uk/2015/1 ... g-systemd/ works for me.

jahboater
Posts: 5759
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: Start at boot

Mon Jul 17, 2017 4:03 pm

Or add it to the end of /etc/rc.local (just before the exit).
Which is actually a systemd service.

Return to “Beginners”