Operating System - HP-UX
1845940 Members
5049 Online
110250 Solutions
New Discussion

Re: /sbin/init.d shutdown problem

 
SOLVED
Go to solution
Mark Mitchell
Trusted Contributor

/sbin/init.d shutdown problem

I keep having oracle freeze durring the shutdown process holding the server up and delaying backup. I have a normal set up where oracle is in the /sbin/rc3.d file to shutdown. Is there any good way to go into the /sbin/init.d/oracle script and change it so that after sleep 300, if the process is still going then a kill -9 is launched on all ora processes.
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor

Re: /sbin/init.d shutdown problem

Mark, normally killing oracle processes is a bad idea. First check to see that your shutdown script does a 'shutdown immediate'
(rather than 'shutdown' or 'shutdown normal').
A 'shutdown abort' will do the killing for you but it is meant to be a weapon of last resort - not for a routine shutdown for backup.
If you really want to do what you asked; it is easy to do with a perl signal handler. The basic idea is to define a signal handler; then
do an alarm(300); issue your oracle shutdown command. If your command succeeds then do an alarm(0) to cancel the alarm and you're done.
Otherwise after 300 seconds the signal handler is tripped to invoke a more drastic shutdown.
This is exactly the same sequence you would do in a c program. I would first try the 'shutdown immediate'; if you are still interested I can attach a sample of perl to get you started.
--- Clay
If it ain't broke, I can fix that.
Mark Mitchell
Trusted Contributor

Re: /sbin/init.d shutdown problem

That sound intersting, I would love to see it. I was thinking before that maybe a simple loop would do the trick.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: /sbin/init.d shutdown problem

Hi Mark:

I've attached a sample perl script to do what you want. It first calls niceshut.sh (which you need to create to do the graceful shutdown) and after 300 seconds if niceshut.sh has not finished it fires of badshut.sh (which you need to create to do the hard shutdown).

A simple loop would not really work well especially with multiple instances. Again, if you can avoid it dont do the kills or the 'shutdown abort'. I assume your existing scripts are doing an su - oracle.

Anyway, this should get you started. BTW you may want to download a bibary distribution of Perl (5.6) from www.perg.com/CPAN (or one of the listed HP-UX Porting Centers); the perl that HP distributes tends to be quite old.
If it ain't broke, I can fix that.