maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   Need to auto start a program at boot (https://talk.maemo.org/showthread.php?t=24073)

sic0048 2008-10-04 21:01

Need to auto start a program at boot
 
OK - forgive me but I am a linux idiot. So hopefully this is an easy question. I need to start a script after the NIT boots and is fully operational (ie connected to the network, etc). What is the easiest way to accomplish this?

Basically I need the equivalent of the "Start Up" folder in windows.

Thanks.

penguinbait 2008-10-04 21:21

Re: Need to auto start a program at boot
 
Quote:

Originally Posted by sic0048 (Post 230469)
OK - forgive me but I am a linux idiot. So hopefully this is an easy question. I need to start a script after the NIT boots and is fully operational (ie connected to the network, etc). What is the easiest way to accomplish this?

Basically I need the equivalent of the "Start Up" folder in windows.

Thanks.

You can take a look at this.

http://nixshell.wordpress.com/2007/0...-init-scripts/

Basically you have a directory in /etc called init.d
If you look in /etc/init.d you will see scripts

These scripts are called like
/etc/init.d/script.sh start
or
/etc/init.d/script.sh stop


The start will start the script, the opt will stop the script.

Once you create a script that can be (at least) started. You then need to make sure it starts on boot..

/etc/init.d is just where the scripts live

There are more directories in /etc

/etc/rc0.d
/etc/rc1.d
/etc/rc2.d
/etc/rc3.d
/etc/rc4.d
/etc/rc5.d
/etc/rc6.d

Basically when the system reaches the corresponding runlevel those scripts are called. Maemo boots up to runlevel 2

So you cd /etc/rc2.d

Then you would link the script to this directory

If you do an ls (LS) you will see lots of links starting with S or K. When entering runlevel 2 it will start in order the S script links. So if you wanted your script to start last, you would link it to the highest number.

cd /etc/rc2.d
ln -s /etc/init.d/script.sh S99scripttocall

Now it will start on boot


All times are GMT. The time now is 04:05.

vBulletin® Version 3.8.8