Balakrishna
Posts: 21
Joined: Sat Aug 31, 2013 9:56 am

How to launch the an application during start up

Sat Sep 21, 2013 5:51 am

Hello Friends,

i have created application using C programming with GCC compiler, so i have to execute the ./a.out file on command prompt directly while starting up of my raspberry pi. so Plz suggest me.

Thanks&Regards
Balakrishna.

gmc
Posts: 123
Joined: Fri Mar 09, 2012 11:31 am
Location: Cheshire, UK
Contact: Website

Re: How to launch the an application during start up

Sat Sep 21, 2013 7:34 am

There are a few methods you use us. Try this:

http://www.raspberry-projects.com/pi/pi ... an/scripts

or

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

or

http://blog.scphillips.com/2013/07/gett ... e-on-boot/

I prefer the last one as you can then easily start/stop the program, but its slightly more complicated to setup.

Balakrishna
Posts: 21
Joined: Sat Aug 31, 2013 9:56 am

Re: How to launch the an application during start up

Thu Sep 26, 2013 6:21 am

Hello gmc,
i have followed u r first link, so i have created the bin directory in /home/pi and written script
#!/bin/bash
#Script to our application
echo"Doing auto run Script..."
sudo /home/pi/Desktop/Camera_App/Camera

& saved it as script_auto_run. i have excecuted this script, it is working fine.

as per steps geiven in the link i have added the /etc/rc.local file as

if[$(tty)==/dev/tty1];then
/home/pi/bin/script_auto_run
#fi

i have reboot my pi but it is not working......

Thanks&Regards
Balakrishna

gmc
Posts: 123
Joined: Fri Mar 09, 2012 11:31 am
Location: Cheshire, UK
Contact: Website

Re: How to launch the an application during start up

Thu Sep 26, 2013 7:16 am

Balakrishna wrote:
if[$(tty)==/dev/tty1];then
/home/pi/bin/script_auto_run
#fi
i dont have access to my pi here, but I'm guessing this is the problem.

Just strip the if statement out and run:

Code: Select all

/home/pi/bin/script_auto_run

Balakrishna
Posts: 21
Joined: Sat Aug 31, 2013 9:56 am

Re: How to launch the an application during start up

Thu Sep 26, 2013 9:52 am

hello Gmc,

thanks for u quick reply it is working fine i have edited my previous code rc.local file........ but i have another problem that my command was executing before, can we execute the same command after login.

Thanks & regards
Balakrishna.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: How to launch the an application during start up

Thu Sep 26, 2013 10:37 am

Have a look at editing .bashrc

Return to “Beginners”