Stille
Posts: 10
Joined: Thu Mar 20, 2014 1:56 am

Question about running programs when Pi starts up

Sun May 11, 2014 10:28 pm

Hi,
I need to run 3 programs at the same time when Rasp Pi starts up, and those 3 programs will keep running (forever, :D). How could I do that?

Someone told me I could write some script in the "rc.local " to run programs when starting up, but that seems to run programs one by one (start another program when one program ends).

Could anyone give me any suggestions?
Thank you!

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Question about running programs when Pi starts up

Sun May 11, 2014 10:30 pm

Put an & at the end of each command you want to run.

User avatar
sav25
Authorised Reseller
Authorised Reseller
Posts: 385
Joined: Thu Aug 30, 2012 7:18 pm
Location: Southend-on-Sea, Essex, UK
Contact: Website Twitter

Re: Question about running programs when Pi starts up

Mon May 12, 2014 11:40 am

Not sure if it works for multiple programs - but I use cron to run a script on boot. RaspberryPiSpy has a good guide:

http://www.raspberrypi-spy.co.uk/2013/0 ... sing-cron/

hampi
Posts: 223
Joined: Fri May 31, 2013 11:29 am
Contact: Website

Re: Question about running programs when Pi starts up

Mon May 12, 2014 1:03 pm

Daemon coding is not that difficult though needs some care and most of all comprehensible log files.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Question about running programs when Pi starts up

Mon May 12, 2014 1:19 pm

To have programs (python or /bin/sh) run at boot and stay running is sort of an art form.

adding the line

nohup /path/to/command 2>&1 > /tmp/programlog &

works in most cases. If it fails to start and run, most issues will be recorded in the logfile.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

Return to “General discussion”