[comp.unix.admin] Gracefull system shutdown

parker@mprgate.mpr.ca (Ross Parker) (03/22/91)

I have a problem that I'm sure other people must have faced at
some point.

We've just installed a database (Oracle) on a Sun Sparc 2 running
SunOS 4.1.1. I would like to somehow arrange that the database
gets *properly* shut down whenever the system is shut down.

The obvious way, and Oracle's suggestion, is to replace /etc/shutdown
with a version that first shuts the database down, then executes
the normal /etc/shutdown command.

I'd rather find another way...

What would be ideal is to somehow arrange for init to wait for
the database to shut down when it's going into single-user
mode. Init sends a signal 15 to all processes, but only waits
for some of them to stop before it (un)gracefully brings the
system down. I can easily enough (and have) arrange for a process
to receive a signal 15, and initiate a database shutdown, and wait
for that shutdown to complete before exiting, but init doesn't
wait for it. The man page for init indicates the following:

     init terminates multi-user operations  and  resumes  single-
     user   mode  if  sent  a  terminate  (SIGTERM)  signal:  use
     `kill -TERM 1'.  If there are  processes  outstanding  which
     are  deadlocked  (due to hardware or software failure), init
     does not wait for them all to die  (which  might  take  for-
     ever),  but  times out after 30 seconds and prints a warning
     message.

Is there any way I can coerce init to believe that the database
shutdown process that I've written should be waited for? 30
seconds of grace is enough to shut down my database...


-- 
Ross Parker			| Why do they put me down?
				| Make out that I'm a clown?
parker@mprgate.mpr.ca		| I drink scotch whisky all day long
uunet!ubc-cs!mprgate!parker	| Yeah I'm gonna save my money
				| (gonna put it all away...)
(604)293-5495			| 'Cause I'm a Scotsman