[SunHELP] General Boot Question


Mon Oct 14 13:46:51 CDT 2002


Well, this is kind of basic unix start stuff.

The default boot level is set in /etc/inittab on the line that looks like
this:
is:3:initdefault:

All activities are really started from /etc/inittab by the init daemon.
Some of these lines, however look like this:
fs::sysinit:/sbin/rcS   >/dev/console 2<>/dev/console </dev/console
s0:0:wait:/sbin/rc0     >/dev/console 2<>/dev/console </dev/console
s2:23:wait:/sbin/rc2    >/dev/console 2<>/dev/console </dev/console
s3:3:wait:/sbin/rc3     >/dev/console 2<>/dev/console </dev/console
s5:5:wait:/sbin/rc5     >/dev/console 2<>/dev/console </dev/console
s6:6:wait:/sbin/rc6     >/dev/console 2<>/dev/console </dev/console

These lines, depending on run level (field 2) will go to the /etc/rc?.d
directory and run all entries starting with "K" or "S".  "K" script are run
with a parameter of "stop" and "S" scripts are run with a parameter of
"start".  So if /etc/rc2.d/S55scriptname exists, then when the system enters
run level 2, the script is run like this, "/etc/rc2.d/S55scriptname start".
You can verify this by looking at the /sbin/rcX script itself - it's only a
shell script.

Now, this startup script can exist only within /etc/rc2.d, or it can located
anywhere else in the box and linked to this location.  Traditionally, the
"master" script is in /etc/init.d but it can really be anywhere.  For
example, for the cron daemon:

# ls -il /etc/rc2.d/*cron
    315471 -rwxr--r--   4 root     sys          513 Jul 15  1997
/etc/rc2.d/S75cron
# ls -li /etc/init.d/cron
    315471 -rwxr--r--   4 root     sys          513 Jul 15  1997
/etc/init.d/cron

if you look (first field is inode number), the rc2.d entry is a hard-link to
init.d (actually, it's not quite correct to think of the script as located
in init.d but it's convenient to write this way).

Here's another, though, that's sym-linked to an application start point:
lrwxrwxrwx   1 root     other       1414 Sep 26  2000
/etc/rc3.d/S77netbackup -> /usr/openv/netbackup/bin/goodies/S77netbackup

...sorry for the wraparound...

Yet another process we have has the script directly in /etc/rc2.d as an "S"
script name and has no other script information elsewhere in the tree.

So, the real answer is that all bootup stuff starts from /etc/inittab.  The
"init" process runs the rc scripts which in turn read the /etc/rc?.d
directories to run scripts located there.  Tradition says that those
/etc/rc?.d scripts are links to "real" scripts in /etc/init.d.  

-M

-----Original Message-----
From: Bret Adams [mailto:bret at fabrikant.com]
Sent: Monday, October 14, 2002 12:30 PM
To: sunhelp at sunhelp.org
Subject: [SunHELP] General Boot Question


Hey Everybody:

This is more of a general UNIX question but I have a bet with a buddy and I 
just want to confirm this so I can settle this issue.

My position is that when UNIX boots up the inittab file designates the 
default level of run level usually three unless someone pushes it to 
another run level at the shutdown command or init command.  Lets say its 
run level three, after starting up the kernel it processes the S scripts in 
rc2.d and then rc3.d.  Usually the S scripts in the rc directories are 
nothing more than links to initialization scripts in /etc/init.d  This way 
you have one central place for administration.

My buddy thinks that the scripts in init.d are used from init.d in the 
bootup process. I am trying to explain that if that was the case then why 
have the rc directories.

I just wanted to confirm that init.d is just a repository for the 
initialization scripts that the rc directories reference through links for 
bootup or shutdown.  Or you can use the scripts in init.d for when you need 
to shutdown and restart services without rebooting.  The actual init.d 
directory is NOT where the system goes to find bootup scripts.

Thanks.

Bret
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list