1823057 Members
3165 Online
109645 Solutions
New Discussion юеВ

rc shutdown scripts

 
SOLVED
Go to solution
Steve Ferrara
Advisor

rc shutdown scripts

Hi,

I would like to shutdown a particular app upon reboot and need step by step instructions regarding how. We are using 11i.

As I understand it, I can create my script in /sbin/init.d and then link this to /sbin/rc0.d. So for example, I have /sbin/init.d/stoptivoli. What do I do then? I never linked before. I know ultimately I'm supposed to end up with a K script in /sbin/rc0.d that links to /sbin/init.d/stoptivoli.

Hope this makes sense...thanks

2 REPLIES 2
Gary L. Paveza, Jr.
Trusted Contributor
Solution

Re: rc shutdown scripts

You probably don't want /sbin/rc0.d. The number after the rc is the run level. You most likely want run-level 3 (after networking is up).

So, what you would do is put the start link in /sbin/rc3.d and the kill link in /sbin/rc2.d. That way when the server transitioned into run level 3 (at bootup) it starts the application, and when it transitions to run level 2 (during shutdown) it executes the shutdown.

First thing is the file in /sbin/init.d This script should be able to start and stop the application depending on the argument. /sbin/init.d/template can give you a starting ground to writing this type of script.

To create the links (assuming your script name is myapp)

ln - s /sbin/init.d/myapp /sbin/rc3.d/Smyapp

ln -s /sbin/init.d/myapp /sbin/rc2.d/Kmyapp

The in the above controls the order. The higher the number the further in the process it occurs. I was always taught that the S + the K should equal 1000. So if you use S900, then it should be K100. This helps to keep consistancy in the startup/shutdown. I would suggest you use a high number like 900+ in order to allow all HP standard software to startup first.

Steven E. Protter
Exalted Contributor

Re: rc shutdown scripts

Most user created startup commands go in run level 3. A few in run level 2.

For oracle and other applications:

S(tart) script goes in /sbin/rc3.d
K(ill) script goes in /sbin/rd2.d

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