LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   How to make my app automatically run on startup (Leopard Board Ti DM 368 ) (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/how-to-make-my-app-automatically-run-on-startup-leopard-board-ti-dm-368-a-947175/)

peacemission 05-28-2012 12:14 AM

How to make my app automatically run on startup (Leopard Board Ti DM 368 )
 
Problem is regarding leopard board (tms320 dm368 processor).
(Please ignore if i sound weird at some places as i am a complete newbieee in Leopard Board/LINUX ) :)

I have a leopard board (tms320 dm368 processor)and
i want to run an app, automatically after boot up instead of manually typing the command in terminal.
So, I created the script file (named vcc_app) as follows
Code:

#!bin/sh
echo "My app is here"
/helloworld # The application

1 .after creating the script file i copied it in init.d
2. I gave the command
Code:

chmod +x /etc/init.d/vcc_app
(vcc_app is the name of script which I have created)
3. Then I gave the command
Code:

ln -s /etc/init.d/vcc_app /etc/rc.d/vcc_app
(rc.d is the run level directory i guess...b/c there is no rc1.d or rc2.d etc...not even rc.local)

Now, when i reboot the board nothing happens (Some times it says vcc_app not found..). Is there anything wrong .
Please help me out !

Many Thanks !

Slackyman 05-28-2012 12:32 AM

Which distro is running on your leopardboard?

otoomet 05-28-2012 12:38 AM

Does your program work correctly if started from the command line (/etc/init.d/vc_app)? Does it start the board?

In general, it is not recommended to put your own code in /etc/init.d. Rather, make a startup script into a standard executable directory (like /usr/local/bin or $HOME/bin) and add the corresponding line into /etc/rc.local (although it may depend on the distro).

Slackyman 05-28-2012 12:55 AM

If you want to start your program by the init system in the way you're planning you have to make sure:
- it can run from /bin/sh
- it does NOT require any lib or program not yet started (e.g. programs running on other runlevels)
- it refers to full paths (not relative)

peacemission 05-28-2012 01:25 AM

Quote:

Originally Posted by Slackyman (Post 4689193)
Which distro is running on your leopardboard?

Its not a distro, i just have a bootloader(uboot,kernel and rootfs.(i am successfully booting it from SD card)
Just for more info:
There are no runlevel dirs like rc1.d or rc2.d etc. rc.local is also not present.All i have is rc.d

peacemission 05-28-2012 01:27 AM

Quote:

Originally Posted by Slackyman (Post 4689199)
If you want to start your program by the init system in the way you're planning you have to make sure:
- it can run from /bin/sh
- it does NOT require any lib or program not yet started (e.g. programs running on other runlevels)
- it refers to full paths (not relative)

Yeah thats correct, but my app just prints "hello world" :)
When em running it manually from terminal it works fine.

peacemission 05-28-2012 01:32 AM

Quote:

Originally Posted by otoomet (Post 4689196)
Does your program work correctly if started from the command line (/etc/init.d/vc_app)? Does it start the board?

In general, it is not recommended to put your own code in /etc/init.d. Rather, make a startup script into a standard executable directory (like /usr/local/bin or $HOME/bin) and add the corresponding line into /etc/rc.local (although it may depend on the distro).

1. Yes, when i run the app manually from the terminal, it works fine (my app just prints "hello world" :) )
2. There are neither runlevel dirs like rc1.d, rc2.d etc nor rc.local. i only have rc.d

Just for more info:
Its not a distro, i just have a bootloader(uboot,kernel and rootfs.(i am successfully booting it from SD card)

Slackyman 05-28-2012 01:54 AM

Not all the scripts in rc.d and init.d are started just because they have tha run flag set!
What's inside your /etc/rc.d and /etc/init.d folders?

peacemission 05-28-2012 04:49 AM

Quote:

Originally Posted by Slackyman (Post 4689228)
Not all the scripts in rc.d and init.d are started just because they have tha run flag set!
What's inside your /etc/rc.d and /etc/init.d folders?

Here is the details of my init.d and rc.d
init.d
Code:

-rwxr-xr-x 1 xyz xyz 3248 2012-05-22 15:18 coprocessors
-rwxrwxr-x 1 xyz xyz  100 2011-07-15 21:04 hostname
-rwxrwxr-x 1 xyz xyz  230 2011-07-15 21:04 mdev
-rwxrwxr-x 1 xyz xyz  85 2011-07-15 21:04 motd
-rwxrwxr-x 1 xyz xyz  476 2011-07-15 21:04 mountall
-rwxrwxr-x 1 xyz xyz  155 2011-07-15 21:04 mountdevpts
-rwxrwxr-x 1 xyz xyz  834 2011-07-15 21:04 network
-rwxrwxr-x 1 xyz xyz  129 2011-07-15 21:04 psplash
-rwxrwxr-x 1 xyz xyz  34 2011-07-15 21:04 startlabel
-rwxrwxr-x 1 xyz xyz  130 2011-07-15 21:04 sysctl
-rwxrwxr-x 1 xyz xyz  43 2011-07-15 21:04 syslogd

rc.d
Code:

lrwxrwxrwx 1 xyz xyz 18 2012-05-22 12:31 S00mountall -> ../init.d/mountall
lrwxrwxrwx 1 xyz xyz 17 2012-05-22 12:31 S00psplash -> ../init.d/psplash
lrwxrwxrwx 1 xyz xyz 20 2012-05-22 12:31 S01startlabel -> ../init.d/startlabel
lrwxrwxrwx 1 xyz xyz 14 2012-05-22 12:31 S02mdev -> ../init.d/mdev
lrwxrwxrwx 1 xyz xyz 18 2012-05-22 12:31 S03hostname -> ../init.d/hostname
lrwxrwxrwx 1 xyz xyz 21 2012-05-22 12:31 S10mountdevpts -> ../init.d/mountdevpts
lrwxrwxrwx 1 xyz xyz 17 2012-05-22 12:31 S10syslogd -> ../init.d/syslogd
lrwxrwxrwx 1 xyz xyz 16 2012-05-22 12:31 S15sysctl -> ../init.d/sysctl
lrwxrwxrwx 1 xyz xyz 14 2012-05-22 12:31 S20motd -> ../init.d/motd
lrwxrwxrwx 1 xyz xyz 17 2012-05-22 12:31 S30network -> ../init.d/network
lrwxrwxrwx 1 xyz xyz 22 2012-05-22 12:31 S90coprocessors -> ../init.d/coprocessors


michaelk 05-28-2012 09:14 AM

In a nutshell, if you look at the rc.d directory the S means start. Processes are started in order i.e S00xxx - S99xxx. Creating the link /etc/rc.d/S99your_app should run your hello world program automatically.

peacemission 05-29-2012 01:44 AM

Quote:

Originally Posted by michaelk (Post 4689433)
In a nutshell, if you look at the rc.d directory the S means start. Processes are started in order i.e S00xxx - S99xxx. Creating the link /etc/rc.d/S99your_app should run your hello world program automatically.

Its working..
Thanks!


All times are GMT -5. The time now is 02:26 AM.