Init script not called during system shutdown

Ravi Shanmugam ravi.shanmugam at sasken.com
Wed Dec 10 06:47:35 UTC 2008


 
Hi Nickolas,

Try to modify the start and stop script as follows.

# cat /etc/init.d/ora-as1
#!/bin/sh
#
# Startup script for Oracle AS 10g R2
# chkconfig: 345 86 14
#
# description:  Bla bla bla

start() {
         su -c "opmnctl startall" - ora-as1
         su -c "emctl start iasconsole" - ora-as1
         touch /var/lock/subsys/ora-as1
}

stop() {
         wall "Stopping ora-as1"
         echo "`date` - Stopping ora-as1" >> /var/log/oracleas10gr2.log
         su -c "emctl stop iasconsole" - ora-as1
         su -c "opmnctl stopall" - ora-as1
	   rm -f /var/lock/subsys/ora-as1
}

i.e add "touch /var/lock/subsys/ora-as1" in start() function and add "rm
-f /var/lock/subsys/ora-as1" in your stop() function.

This will work.

Regds,
Rav

------------------------------

Message: 6
Date: Tue, 09 Dec 2008 14:59:00 +0100
From: SIG - P?dagogie <sigpedag at univ-paris1.fr>
Subject: Init script not called during system shutdown
To: redhat-list at redhat.com
Message-ID: <493E79A4.2080906 at univ-paris1.fr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

I'm using an up-to-date Red Hat Enterprise Linux 4.7 (64 bits) system
and I'd like to setup a startup/shutdown script to manage an Oracle AS
10g R2 installation.

The script works fine (start/stop/restart) when called from a bash
prompt and it's launched at system startup with no problem.

The issue is that it's no called at all when the system shuts down, I
checked runlevels, permissions for the script, I even put some "wall" 
and "echo" in it...

I try different priorities, different script names, different shells,
it's always the same. The only particularity of the script is that the
commands I launch need to run under a user with no privileges, I use
"su" for that.

(Once again, everything works when it's called from a shell, so doesn't
seem to be "su"-related and the "wall" and "echo" command that should be
exectued in root aren't executed)

I have absolutely no idea why this happens...

========================================================================
=

# ls -l /etc/init.d/ora-as1
-rwxr-xr-x  1 root root 617 Dec  9 14:45 /etc/init.d/ora-as1

========================================================================
=

# cat /etc/init.d/ora-as1
#!/bin/sh
#
# Startup script for Oracle AS 10g R2
# chkconfig: 345 86 14
#
# description:  Bla bla bla

start() {
         su -c "opmnctl startall" - ora-as1
         su -c "emctl start iasconsole" - ora-as1 }

stop() {
         wall "Stopping ora-as1"
         echo "`date` - Stopping ora-as1" >> /var/log/oracleas10gr2.log
         su -c "emctl stop iasconsole" - ora-as1
         su -c "opmnctl stopall" - ora-as1 }

# See how we were called
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   restart)
         stop
         start
         ;;
   *)
         echo "Usage: $0 {start|stop|restart}"
esac

exit 0

========================================================================
=

# find /etc/rc* -type l -name "*ora-as1*"
/etc/rc.d/rc1.d/K14ora-as1
/etc/rc.d/rc2.d/K14ora-as1
/etc/rc.d/rc3.d/S86ora-as1
/etc/rc.d/rc4.d/S86ora-as1
/etc/rc.d/rc0.d/K14ora-as1
/etc/rc.d/rc5.d/S86ora-as1
/etc/rc.d/rc6.d/K14ora-as1

========================================================================
=

# chkconfig --list ora-as1
ora-as1         0:off   1:off   2:off   3:on    4:on    5:on    6:off

========================================================================
=

Any idea?
--
Nicolas


SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In 
case you are not the original intended Recipient of the message, you must not, directly or 
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are 
requested to delete it and inform the sender. Any views expressed in this message are 
those of the individual sender unless otherwise stated. Nothing contained in this message 
shall be construed as an offer or acceptance of any offer by Sasken Communication 
Technologies Limited ("Sasken") unless sent with that express intent and with due 
authority of Sasken. Sasken has taken enough precautions to prevent the spread of 
viruses. However the company accepts no liability for any damage caused by any virus 
transmitted by this email





More information about the redhat-list mailing list