1822512 Members
2524 Online
109642 Solutions
New Discussion юеВ

Shutdown Scripts

 
SOLVED
Go to solution
Qcheck
Super Advisor

Shutdown Scripts

From the following thread I noticed that startup scripts should be in rc3.d and shutdown scripts in rc0.d:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1078076

Is the above right?

The reason I am asking is, I put my shutdown scripts under rc2.d and probably that is the reason that server is taking forever to reboot. So I did rs to come the server fast, even though that is not the gentle way to reboot, this is just a test node and no database is there.

Please throw some light....
10 REPLIES 10
Johnson Punniyalingam
Honored Contributor

Re: Shutdown Scripts

>>The reason I am asking is, I put my shutdown scripts under rc2.d<<

The basics:

The systems boots into multi-user level. The script files should be located in /sbin/init.d and a symbolic link with the name:

/sbin/rc3.d:
SNNservice_name To start the service

/sbin/rc0.d
KNNservice_name To stop the service

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Robert Salter
Respected Contributor

Re: Shutdown Scripts

Pratibha,

There's nothing wrong with linking your shutdown scripts in the rc2.d directory. This is associated with run level 2, which is still at a multi-user level, but if you want your apps to be down at that run level, it's your call.

As for taking so long to reboot, check the /etc/rc.log to see what is being shutdown and how long it's taking. Could be the shutdown script that's causing the problem, not the run level it runs in.

robert
Time to smoke and joke
James R. Ferguson
Acclaimed Contributor

Re: Shutdown Scripts

Hi:

The manpages for 'rc(1M)' tell you everything you need to know:

"If a start script link (e.g., /sbin/rcN.d/S123test) in sequencer N has a stop action, the corresponding kill script should be placed in sequencer N-1 (e.g., /sbin/rcN-1.d/K200test). Actions started in level N should be stopped in level N-1. This way, a system shutdown (e.g., transition from level 3 directly to level 0) will result in all subsystems being stopped."

If you have a startup script in level-3 with its shutdown component linked at level-0 the process will still work; it just isn't consistent with the standard.

If you do a 'reboot' the normal shutdown scripts are *not* executed. The 'reboot' command is actually the last step of 'shutdown', so of course, an ungraceful down is faster than a graceful one!

Regards!

...JRF...


Robert Salter
Respected Contributor

Re: Shutdown Scripts

Or even you startup script could be the culprit. Check the /etc/rc.log.

Forgot to add this on the first reply, sorry.

robert
Time to smoke and joke
Qcheck
Super Advisor

Re: Shutdown Scripts

James, I use # shutdown -r now to reboot the server. And Robert, I will check the scripts too.

Yeah, for some reason all our HPUX servers takes so long to reboot(atleast 15 min), that is the reason I started to research, as I rebooted one server today.
Pete Randall
Outstanding Contributor

Re: Shutdown Scripts

Some HPUX servers (like the K series, for example) took a notoriously long time to reboot, and most of that time was spent in diagnostics, before the rc scripts were even begun executing. You might want to take a further look at just where your delay is occurring. If it is in the rc script execution, try to narrow it down to the one(s) that seem to take the longest, then take a closer look at those to see if there might be something that could be optimized.


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: Shutdown Scripts

Hi (again):

> use # shutdown -r now to reboot the server

The 'now' argument only means don't wait before beginning to execute the shutdown sequence. This doesn't mean don't execute the kill scripts!

Regards!

...JRF...
Qcheck
Super Advisor

Re: Shutdown Scripts

I can see the startup logs in /etc/rc.log and /etc/rc.log.old but where can I see the errors logged during the shutdown. I mean, I want to find the errors logged from the shutdown scripts but not the startup scripts.
Patrick Wallek
Honored Contributor

Re: Shutdown Scripts

The errors for shutdown should be logged in /etc/rc.log.old.

Look towards the end of the file and you should see a lot of information about /sbin/rc?.d/K* scripts being run.
James R. Ferguson
Acclaimed Contributor
Solution

Re: Shutdown Scripts

Hi:

> I want to find the errors logged from the shutdown scripts but not the startup scripts.

# Look at '/etc/rc.log.old' for your last shutdown messages.

That said, why do you think you have errors during the running of shutdown scripts?

A server taking "fowever" to reboot could point to long startup or long shutdown.

Do you have an Oracle database, perhaps, where the database is asked to shutdown but has to wait for all updates to complete? Watching the events on the *console* will probably tell you much more than the 'rc' logs. The console checklist gives you a better measure of which step(s) require the most time to complete.

Regards!

...JRF...