Operating System - HP-UX
1832642 Members
3318 Online
110043 Solutions
New Discussion

Ascending or Descending sequence for shutdown

 
SOLVED
Go to solution
Jonathan Corbeill
Occasional Advisor

Ascending or Descending sequence for shutdown

I understand that the shutdown process will execute "K" prefixed scripts in the rc?.d directories. My question is whether it executes these scripts in ascending or descending sequence. For example in rc2.d if there are two scripts K900script1 and K901script2 which script will get executed first during shutdown?
6 REPLIES 6
Danny Engelbarts
Frequent Advisor

Re: Ascending or Descending sequence for shutdown

Jonathan,

This is from man 1m rc;

A three digit number is used for sequencing scripts within the sequencer directory. Scripts are executed by type (start or kill) in alphabetical order as defined by the shell. Although it is not recommended, two scripts may share the same sequence number.

So the K900 will be executed before K901

Greetz, Danny.
Rick Garland
Honored Contributor

Re: Ascending or Descending sequence for shutdown

The numbers are for ascending numerical sequence
Madhu Sudhan_1
Respected Contributor

Re: Ascending or Descending sequence for shutdown

I think it will be kill'ed in the reverse order of how they are started.

For example if the subsystem/applications are started in this order

Subsystem1->Subsystem2->application1->application2

then they will be killed in the order
application2->application1->Subsystem2->Subsystem1.

...Madhu
Think Positive
Patrick Wallek
Honored Contributor
Solution

Re: Ascending or Descending sequence for shutdown

Madhu is essentially correct.

If there is a start script that S100App1, S200App2, S300App3 then there are generally kill scripts like K700App3, K800App2, K900App1 so that App1 is started first, then App2, then App3. The Kill scripts get executed in numerical order just like the start scripts, but the scripts are generally defined to shut things down in the reverse order that they are started so App3 will shutdown first, then App2, then App1.

The general rule, for whatever reason, is that if you add the numeric portion of the S & K scripts together then they should equal 1000.
James R. Ferguson
Acclaimed Contributor

Re: Ascending or Descending sequence for shutdown

Jonathan:

The scripts -- (S)tart or (K)--- are executed in lexicographical order, the entire file name of the link being used for the ordering. That's the beauty/simplicity of the mechanism. Thus, within rc.d, a K900 script would execute before a K901 script.

Take a look at /usr/share/doc/start_up.txt or at the Startup & Configuration White Paper:

http://docs.hp.com/hpux/onlinedocs/os/startup.pdf

...JRF...

...JRF...
Madhu Sudhan_1
Respected Contributor

Re: Ascending or Descending sequence for shutdown

The easiest way to remember/know how they get killed is to go and fire the ll command in the rc?.d directory. The order in which they appear is the order in which they get killed.

Enjoy !

Thanks,
Madhu
Think Positive