Operating System - HP-UX
1834391 Members
1963 Online
110066 Solutions
New Discussion

Re: /etc/rcx.d directory scripts

 
SOLVED
Go to solution
susee_sundar
Regular Advisor

/etc/rcx.d directory scripts

Hi,

I know that /etc/rcx.d is the runlevel directoy which is selected to the corresponding init level..?

My query is

the rc2.d directory conatins both start(s) & kill(k) scipts.

1.which scripts will run when i move from rc1 to rc2 ?

2.which scripts will run when i move from rc3 to rc2 ?

13 REPLIES 13
Pete Randall
Outstanding Contributor
Solution

Re: /etc/rcx.d directory scripts

First, the directory is /sbin not /etc.

1. from rc1 to rc2 the s scripts will run

2. from rc3 to rc2 the k scripts will run.


Pete

Pete
spex
Honored Contributor

Re: /etc/rcx.d directory scripts

It's also worth mentioning that startup and shutdown scripts are executed in lexicographical order, so in this example (from /sbin/rc2.d):

K130samba -> /sbin/init.d/samba
K200tps.rc -> /sbin/init.d/tps.rc

when the system goes from a higher runlevel to runlevel 2, samba will be killed before tps, even though they may have been started in reverse order.

PCS
Pete Randall
Outstanding Contributor

Re: /etc/rcx.d directory scripts

Actually,, the kill scripts are executed in descending numerical order so samba would be killed last.


Pete

Pete
Darrel Louis
Honored Contributor

Re: /etc/rcx.d directory scripts

Susee,

Pete is correct but he should have mentioned the Capital S and K

Darrel
Enrico P.
Honored Contributor

Re: /etc/rcx.d directory scripts

Pete,
I knew this also but from the man rc seems that the script should be started in alphabetical order at the start and at the stop.

Enrico
spex
Honored Contributor

Re: /etc/rcx.d directory scripts

From 'man rc':

When ordering start and kill script links, note that subsystems started in any given order should be stopped in the reverse order to eliminate any dependencies between subsystems. This means that kill scripts will generally not have the same numbers as their start script counterparts. For example, if two subsystems must be started in a given order due to dependencies (e.g., S111house followed by S222uses_house), the kill counterparts to these scripts must be numbered so that the subsystems are stopped in the opposite order in which they were started (e.g., K555uses_house followed by K777house).

So in my example, samba is killed before tps.

PCS
Pete Randall
Outstanding Contributor

Re: /etc/rcx.d directory scripts

Then the man page is wrong.


Pete

Pete
Pete Randall
Outstanding Contributor

Re: /etc/rcx.d directory scripts

Oops, wait a minute, I was wrong on that - got myself confused.

You're right - samba would be killed first.


Pete

Pete
spex
Honored Contributor

Re: /etc/rcx.d directory scripts

Hehe. Not a problem--it is a confusing topic.

PCS
susee_sundar
Regular Advisor

Re: /etc/rcx.d directory scripts

Hi Guys.,

I got confused with your Replies..

Lets Clear me this.

FROM RC1 TO RC2

content of /etc/rc2.d runs as
s1-->s2--->s3--->..upto s100

FROM RC3 TO RC2

contents of /etc/rc3.d runs as
k100-->k99-->k98-->...k1

Is this Correct update me
Arunvijai_4
Honored Contributor

Re: /etc/rcx.d directory scripts

Yes, If you read Pete's reply, this would have become quite clear.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Steven E. Protter
Exalted Contributor

Re: /etc/rcx.d directory scripts

Shalom susee,

Hopefully I don't muddy the waters further.

As a machine starts up, it goes from

Run Level 0
to 1
to 2
to 3
# Or higher if set in /etc/inittab

As it goes from run level to run level going up, all scripts starting with a captial S are executed in ascii alphabeticall order.

S100startthis
S102startthat

As a machine is shutting down, or goes from runlevel 3 to 2 then 1 then zero, the K(kill) scripts are executed. Only capital K.

K900stopthips
K810oracle

If you check these files, you see they are actually soft links to start/shut scripts in /sbin/init.d

Example:

Lets say the machine is at run level 2
The following soft links are in /etc/rc3.d

S800oracle
S810httpd

We run init 3 to take the system to run level 3

The soft links are run as follows:

S800oracle
S810httpd

Note that this causes execution of the start/stop script in /sbin/init.d

Lets say S800oracle points to /sbin/init.d/oracle

What actually happens is /sbin/init.d/oracle start

And so on.

More clear?

Hopefully.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
susee_sundar
Regular Advisor

Re: /etc/rcx.d directory scripts

Hi guys,

Thanks to All for your Great Respone..
I am closing the thread since I got the solution with the last reply.