Showing results for 
Search instead for 
Did you mean: 

how to add the startup script in hp-unix

Super Advisor

how to add the startup script in hp-unix

how to add the startup script in hp-unix 11.31


Re: how to add the startup script in hp-unix

A quick explanation. 

- Startup and stop scripts in 11.31 are located in "/sbin/initd.d/"

- Configuration files/items, like variables should be placed in /etc/rc.config.d/

 There is a "template" file in /sbin/init.d that you should copy, rename and use. It also has some general descriptions. 

Modify/add the 4 possible options in the "case $1" statement.

Test start and stop:

To start run:

"/sbin/init.d/<your_script> start "

To stop run:

"/sbin/init.d/<your_script> stop"

To let HPUX run the script during startup and stop, you need to add symbolic links.

First you need to decide in which run-level the script should be started. E.g. 2

Under /sbin you will find directories named "rc1.d, rc2.d, rc3.d" etc.... 

The number is the run-level.

If you want your script to be run when entering run-level2, then you will need to create a symbolic link to your script in "rc.2.d".

The symbolic link-name need to begin with a "S" and a number and point to your created startup-script. (check the files/links in the directory and you will understand.  E.g. "S432my_new_startup -> /sbin/init.d/<your_script>"

Note that your script will now be called twice when entering run-level 2.

First time with option "start_msg", second time with option "start". (Its all scripted, check "/sbin/rc" ).

The number that you put into your symbolic link defines the order of the startup. lower numbers are called first.

The same method needs to be applied when doing the stop.

In the example, you would want your script to be run with the "stop" option when moving from run-level 2 to run-level 1.

Thus, you need to add a link in "/sbin/rc1.d/". This link need to start with "K" followed by a number.....

Run "ll /sbin/*/*audit", and you will understand how that should look like. (i picked up the audit-script as an example)

Hope that helps.


I am an HPE Employee

Accept or Kudo