waltd
Posts: 27
Joined: Mon Feb 18, 2013 12:58 pm

Start a program at startup

Thu Feb 28, 2013 1:30 am

Hi all,
How do I setup a program to automatically run when the Raspberry Pi is startup and reboot? Specifically I want the BOINC program to automatically run at startup and reboot. Regards, waltd

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Start a program at startup

Thu Feb 28, 2013 5:55 am

At least a couple of different ways
1. crontab
- @reboot time in crontab will run it at boot time
2. modify init scripts
- adding a file in /etc/init.d/ and then using update-rc.d to start it at default run levels
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

Lumpynose
Posts: 37
Joined: Thu Feb 28, 2013 6:07 am

Re: Start a program at startup

Thu Feb 28, 2013 6:21 am

You may find it helpful to control the program you're starting if you put its invocation in a shell script. That way the shell script can set environment variables, change directories, etc. just before starting the program. Then either make the shell script executable or in crontab or wherever start it with "sh -c yourscript". I prefer using sh -c. The linux sites should have documentation and examples on how to add startup stuff with init.d and crontab.

waltd
Posts: 27
Joined: Mon Feb 18, 2013 12:58 pm

Re: Start a program at startup

Thu Feb 28, 2013 7:26 am

Thank you.

Bikeman
Posts: 63
Joined: Sun Nov 04, 2012 9:03 pm
Location: near Hannover, Germany

Re: Start a program at startup

Thu Feb 28, 2013 5:05 pm

waltd wrote:Hi all,
How do I setup a program to automatically run when the Raspberry Pi is startup and reboot? Specifically I want the BOINC program to automatically run at startup and reboot. Regards, waltd
If you are installing BOINC from the Raspbian repo (minimum is package "boinc-client" ) , then it actually runs as a daemon under a user "boinc" and is started / stopped automatically when the system boots/shuts down. All out of the box.

Cheers
HBE

Return to “Beginners”

Who is online

Users browsing this forum: iosif35 and 42 guests