Solaris 10: cannot gracefully shutdown legacy services?

Solaris 10: cannot gracefully shutdown legacy services?

Post by glro.. » Sat, 12 Nov 2005 07:44:01



I'm running Oracle on SunOS 10 and have a script that
starts/stops it at system boot/shutdown.  I've placed the script
in /etc/init.d and placed a link to it named 'S97ora-ctl' in
/etc/rc3.d and links named 'K02ora-ctl' in /etc/rc[01].d.  Upon
boot, Oracle starts up just fine.

Upon a shutdown (`init s` or `init 0`), my logs indicate that the
script is invoked, yet before it gets a chance to shut down
gracefully, someone (init?  svc.startd?) hits the Oracle
processes with a SIGTERM.

Reading `man init`, I find:

  Run Level Changes
     When a run level change request is made, init or a designate
     sends the warning signal (SIGTERM) to all processes that are
     undefined in the target run level.  A  minimum  interval  of
     five seconds is observed before init or its designate forci-
     bly terminates these processes  by  sending  a  kill  signal
     (SIGKILL).

It looks like the /sbin/rcS (or /sbin/rc1) script is getting
invoked in the background and then this blanket SIGTERM is sent
out before any of the "K" scripts can do their thing.

Here's what I see in /var/svc/log/rcS.log:

  Nov  8 16:04:57 Executing /sbin/rcS stop
  Setting _INIT_RECONFIG.
  Executing legacy init script "/etc/rcS.d/K02ora-ctl".
  Stopping database DEVEL1 at Tue Nov 8 16:05:03 EST 2005
  Killed
  Database DEVEL1 stopped

What I want to see is:

  Stopping database DEVEL1 at Fri Oct 28 19:48:05 EDT 2005
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  Database DEVEL1 stopped

I tried removing the "K" scripts and added the following line to
/etc/inittab:

  h2:s01:wait:/etc/init.d/ora-ctl stop

This invokes the script (twice?!), but the darn SIGTERM still
goes out before the script can complete.

I have the following questions:

1) Is there a quick way that can I prevent the SIGTERM from being
   sent to the Oracle processes?  There are about 15 of them, and
   the process name happens to include the name of the database
   instance (which can and will change during development!).
   E.g.:

  oracle   480     1   0 16:47:06 ?           0:01 ora_pmon_DEVEL1
  oracle   482     1   0 16:47:07 ?           0:00 ora_mman_DEVEL1
  oracle   484     1   0 16:47:07 ?           0:00 ora_dbw0_DEVEL1
  ...

2) What's the "right" way to set this up?

3) Which process is sending the SIGTERM?

4) Why did the inittab line cause the script to execute twice
   when going from run level 3 to run level s?

 
 
 

Solaris 10: cannot gracefully shutdown legacy services?

Post by Bruce Porte » Mon, 14 Nov 2005 02:35:30



> I'm running Oracle on SunOS 10 and have a script that
> starts/stops it at system boot/shutdown.  I've placed the script
> in /etc/init.d and placed a link to it named 'S97ora-ctl' in
> /etc/rc3.d and links named 'K02ora-ctl' in /etc/rc[01].d.  Upon
> boot, Oracle starts up just fine.

> Upon a shutdown (`init s` or `init 0`), my logs indicate that the
> script is invoked, yet before it gets a chance to shut down
> gracefully, someone (init?  svc.startd?) hits the Oracle
> processes with a SIGTERM.

> Reading `man init`, I find:

>   Run Level Changes
>      When a run level change request is made, init or a designate
>      sends the warning signal (SIGTERM) to all processes that are
>      undefined in the target run level.  A  minimum  interval  of
>      five seconds is observed before init or its designate forci-
>      bly terminates these processes  by  sending  a  kill  signal
>      (SIGKILL).

> It looks like the /sbin/rcS (or /sbin/rc1) script is getting
> invoked in the background and then this blanket SIGTERM is sent
> out before any of the "K" scripts can do their thing.

> Here's what I see in /var/svc/log/rcS.log:

>   Nov  8 16:04:57 Executing /sbin/rcS stop
>   Setting _INIT_RECONFIG.
>   Executing legacy init script "/etc/rcS.d/K02ora-ctl".
>   Stopping database DEVEL1 at Tue Nov 8 16:05:03 EST 2005
>   Killed
>   Database DEVEL1 stopped

> What I want to see is:

>   Stopping database DEVEL1 at Fri Oct 28 19:48:05 EDT 2005
>   Database closed.
>   Database dismounted.
>   ORACLE instance shut down.
>   Database DEVEL1 stopped

> I tried removing the "K" scripts and added the following line to
> /etc/inittab:

>   h2:s01:wait:/etc/init.d/ora-ctl stop

> This invokes the script (twice?!), but the darn SIGTERM still
> goes out before the script can complete.

> I have the following questions:

> 1) Is there a quick way that can I prevent the SIGTERM from being
>    sent to the Oracle processes?  There are about 15 of them, and
>    the process name happens to include the name of the database
>    instance (which can and will change during development!).
>    E.g.:

>   oracle   480     1   0 16:47:06 ?           0:01 ora_pmon_DEVEL1
>   oracle   482     1   0 16:47:07 ?           0:00 ora_mman_DEVEL1
>   oracle   484     1   0 16:47:07 ?           0:00 ora_dbw0_DEVEL1
>   ...

> 2) What's the "right" way to set this up?

Use SMF, add a simple start/stop service.

Quote:

> 3) Which process is sending the SIGTERM?

> 4) Why did the inittab line cause the script to execute twice
>    when going from run level 3 to run level s?

--
        Bruce

"The internet is a huge and diverse community and  
not every one is friendly"                            
        http://www.ytc1.co.uk                    

 
 
 

1. Solaris 10 legacy run initscripts at shutdown

I have a product which installs an initscript as /etc/init.d/product.

This is linked from /etc/rc3.d/S90product so that it gets started when
the system enters multi user server mode.
In /var/svc/log/milestone-multi-user-server:default.log, I can see that
Solaris does indeed start it during system boot.

The initscript is also linked from /etc/rc0.d/K10product so that it is
cleanly shut down when the system is shut down.
I can see no evidence that this is ever invoked when the system is shut
down.

How is clean shutdown of legacy stuff supposed to work?

Should this shutdown link be in another directory? eg: /etc/rcS.d?

Is any product with a clean shutdown requirement required to become a
true "service", managed by SMF?
I know it might be desirable, but is it required?

Thanks

{{{ Andy

2. Acrobat Reader Installation Problem

3. Solaris 10 SMF - legacy apps?

4. 10 GA new install. X-server cannot be started on Display :0

5. Solaris 10 b72 : Xterms on legacy app do not work

6. How to write to a file in Linux Kernel

7. Solaris 10 and Solaris Service Manager

8. Linux RSH configuration

9. Solaris 10, built new disk, now cannot boot off solaris 8 disk???

10. Solaris 10 : How to configure the reboot / shutdown entries for the logout menue of a user?

11. Solaris 10 adding service, sequence

12. Jumpstart solaris 10 b69 and solaris 10 b72 on an Ultra 30

13. Solaris 10: ntp service in maintenance, why?