LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   what is the scripts in /etc/init.d for? (https://www.linuxquestions.org/questions/linux-general-1/what-is-the-scripts-in-etc-init-d-for-480957/)

blackzone 09-06-2006 10:53 AM

what is the scripts in /etc/init.d for?
 
don't know what it's for.

apolinsky 09-06-2006 11:04 AM

These are all the startup scripts for the system. Depending on your distribution, there may be a softw link to various other directories to start and stop the functions. Redhat based distributions will place the links in /etc/rc.d/rcx.d The x will be replaced with the number 1 - 6, corresponding to a run level. If you boot to a graphical environment the default run level is 5. If you boot to a command prompt, the run level is probably 3; it is 2 in Debian based distributions.

jlliagre 09-06-2006 11:15 AM

"man init.d" will tell you.

Edit: sorry, "man init.d" is probably missing on your Linux distribution, I was wrongly thinking that was a Solaris related question.

blackzone 09-06-2006 12:59 PM

so basically every time you boot, first the rc.d directory is checked to see what to load, then the scripts in the /etc/init.d is to load the program?

apolinsky 09-06-2006 01:26 PM

You are close. If you take a look at my abbreviated answer, it alluded to run levels. You can find your default run level from the /etc/inittab file. It will list, among other things, the default run level. Let us assume you are running a Debian, or derivative distribution, and generally come up at the command line prompt. The default run level is 2. The scripts that would get run are located in /etc/rc.d/rc2.d. These 'scripts' are really links to similarly named scripts in the /etc/init.d directory. It is the mechanism that allows a subset of all scripts to be run at a specific run level. Slackware choses a bsd type of approach. The scripts to be run are stored in the /etc/rc.d directory.

hpladd 09-06-2006 04:48 PM

more init.d questions
 
Hey,

I'm running a distro called Knoppmyth, and I'm studying the boot process.

In my /etc/inittab script it reads:

Quote:

10:0:wait:/etc/init.d/rc 0
11:1:wait:/etc/init.d/rc 1
12:2:wait:/etc/init.d/rc 2
and so on ...
From this I expected that there would be directories named /etc/init.d/rc 0, and /etc/init.d/rc 1, (and so on). But these directories do not exist on my machine.

However, there are /etc/rc0.d, /etc/rc1.d , (and so on) directories. These directories are filled with K** and S** links to various init.d/* files. (Example: S35networking -> ../init.d/networking)

Long story short, because of inittab's references, I expected to find a whole bunch of S... and K... files in the /etc/init.d/rc # directories, not in the /etc/rc#.d directories.

I don't understand why a file as rudimentry as inittab would reference several files that do not exist? And I don't understand how the machine knows to use the etc/rc#.d directories. (I might be incorrectly assuming that the /etc/rc#.d directories are reference at boot.)

Is this typical, or is this a particular to Knoppmyth -- which is a specialized distro?

ntubski 09-06-2006 09:16 PM

Code:

/etc/init.d/rc 0
#Not the same as
/etc/init.d/rc0

Note the space. This actually runs the file /etc/init.d/rc with an argument of 0.

hpladd 09-06-2006 11:10 PM

hmmm... that does make a difference. So /etc/init.d/rc 0 references (perhaps I could use the term "calls") /etc/rc0.d via the 0 argument. That makes sense. Ah! that feels better. Thanks


All times are GMT -5. The time now is 09:34 PM.