LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   script file (https://www.linuxquestions.org/questions/linux-newbie-8/script-file-416307/)

karpa 02-16-2006 09:42 PM

script file
 
Hi i am very new to linux, (i have ubantu) and would like to start a program when the pc boots.
What i found out so far is to put a command in /etc/rcS.d Am i right? if so, how shall i write the command?

pixellany 02-16-2006 10:45 PM

Read the man pages on inittab.
from inittab, you eventually get to the links in the various rc files. prefix "K" means kill when entering this runlevel, and "S" means start. The files link to scripts in /etc/init.d, but they can also be just links to basic commands.

Various books have a complete narrative on the whole init process. There is probably also an online tutorial.

pixellany 02-16-2006 10:45 PM

dup post--sorry

karpa 02-17-2006 03:34 AM

Sorry but can you explain in detail, as I only had linux for 3 days, and only know a little.

saman007uk 02-17-2006 04:59 AM

If you are not root, run:
Code:

sudo bash
This will ask you for your password. Then run:

Code:

cp script /etc/init.d/script
updare-rc.d script defaults

Here, script is the name of the script.

karpa 02-17-2006 10:18 AM

ok, i understood that but what shall i write in the script.

marozsas 02-17-2006 11:48 AM

For general purpose tasks, there is /etc/rc.local or as in SuSE, /etc/rc.d/boot.local.

This file is executed at the boot time, just before the system becomes ready to use. All resources are ready at time this file is executed. You can call any scripts you want here.

The scripts at /etc/init.d/rc<n>.d/ are symbolic links to files on /etc/init.d/ and they follow a strict convention about syntax, dependencies about another services, special comments in the header of file used by programs like chkconfig. They are used to start/stop daemons for several services.

My advice is to put any local stuff to rc.local or whatever it is the name in your system.


I hope this can help,


All times are GMT -5. The time now is 10:32 PM.