Operating System - HP-UX
1753418 Members
4696 Online
108793 Solutions
New Discussion юеВ

application startup-shutdown scripts--hp-ux 11i v2

 
sheevm
Regular Advisor

application startup-shutdown scripts--hp-ux 11i v2

Hi All,

What is the best place to put these scripts to ensure graceful startup/shutdown of the applications? Is /sbin/init.d is the right place? If it is how do I check the server status like "start" or "stop" to call proper application scripts in my script?

Thanks.
Rajim
be good and do good
9 REPLIES 9
rariasn
Honored Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

Hi rajim,

# man rc

rgs,

ran
James R. Ferguson
Acclaimed Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

Hi Rajim:

Note only is that the best place, but is the proper place.

For a complete understanding of the startup/shutdown paradigm from 10.x through 11.23, see:

http://docs.hp.com/en/934/startup.pdf

See also, the manpages for 'rc(1M) and its referenced manpages.

http://docs.hp.com/en/B2355-60105/rc.1M.html

Regards!

...JRF...
spex
Honored Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

Rajim,

Copy /sbin/init.d/template to /sbin/init.d/yourapp and customize. Then create start (S) and kill (K) scripts (symlinks to /sbin/init.d/yourapp) for the appropriate runlevels in the /sbin/rc?.d directories.

PCS
spex
Honored Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

Place configuration in /etc/rc.config.d/yourapp, if applicable.
DCE
Honored Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

rajim,

It is indded the right placee. In fact there is a template file in directory to help you build the script correctly. You will include bothe stop and start commands in one scripts

Then in one on the /sbin/rcX.d directories you link to your /sbin/init.d script. The script will either stop or start depending on the first letter of the script. (S or K)

Finally, you put a file in /etc/rc.config.d containing a flag that tells the script to run or not run.

It sounds complicated, but actually is quite easy - look at an eisting app for an example.
sheevm
Regular Advisor

Re: application startup-shutdown scripts--hp-ux 11i v2

This is great!! so much detail explaination. I thank all of you.

One more question before assigning the points:

I want the

application to shutdown first thing when system going down.

application to start last when the system is coming up

If I put the link like below will it work?


/etc/rc3.d/K750app------>/sbin/init.d/app
/etc/rc3.d/S750app------->/sbin/init.d/app

Thanks.
Raji
be good and do good
Darrel Louis
Honored Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

Hi Raji,

It depends if K750/S750 is the highest number in rc3.d.

Then this should be oke.

GoodLuck

Darrel Louis
OldSchool
Honored Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

BTW: if the start-up is at runlevel 3, the start link goes in rc3.d, and the kill link in rc2.d
James R. Ferguson
Acclaimed Contributor

Re: application startup-shutdown scripts--hp-ux 11i v2

Hi (again) Rajim:

To have your application be one of the last things started, create a link in '/sbin/rc3.d' like 'S750' (if that is unused). This assumes that run-level-3 is your normal, highest run-level. Look at your '/etc/inittab' to verify this.

If a start script runs in sequence level 'N', then its corresponding kill script should be placed at sequence 'N-1'.

Remember too, the "rule of 1000". A kill script and a start script should differ by this number. Since you want to reverse the order of startup during a shutdown, 1000-750 = 250, so your startup as 'S750' should shutdown at 'K250'.

Following this last rule means that you preserve the relationship between various dependent startup and shutdown tasks.

Regards!

...JRF...