Tags: boot, gracefully, init, legacy, operating, oracle, placed, running, script, scriptin, services, shutdown, software, solaris, stops, sunos, system, thatstarts

Solaris 10: cannot gracefully shutdown legacy services?

On Software » Solaris Operating System

5,618 words with 1 Comments; publish: Tue, 20 May 2008 08:55:00 GMT; (40062.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?

All Comments

Leave a comment...

  • 1 Comments
    • On Thu, 10 Nov 2005 14:44:01 -0800, glroma wrote:

      > 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.

      > 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; Tue, 20 May 2008 08:56:00 GMT