Shutdown scripts

Hello all

I'm trying to automate the startup/shutdown of my database whenever the OS is bounced ...

OS : Linux (Kernel : 2.4.20.-6)
Oracle : 9.2.0.5

The contents of /etc/init.d/dbora file is listed below

case "$1" in

'start')
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart"
su - $ORACLE_OWNER -c "lsnrctl start LISTENER"
su - $ORACLE_OWNER -c "agentctl start"
;;
'stop')
su - $ORACLE_OWNER -c "agentctl stop"
su - $ORACLE_OWNER -c "lsnrctl stop LISTENER"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut"
;;
*)
echo $"Usage: $prog {start|stop}"
exit 1
esac
exit

Contents of /etc/oratab is
ORA920:/u01/app/oracle/product/9.2.0:Y

I created all the required links

ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc4.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc6.d/K10dbora

I shutdown the Linux system using both init 6 and init 0 and in both cases the automation process started up the oracle instance but it did not shut the oracle instance down before shutting down Linux system.My S* scripts are working fine but not my K* scripts. Am I missing something here ?

PS:
There are 2 files in /etc/rc0.d and /etc/rc6.d ,

S00killall -> ../init.d/killall*
S01reboot -> ../init.d/halt*

Why are these S* scripts in rc0 and rc6 directories ...Seems to me like these S* scripts are getting executed before the K* scripts in in /etc/rc0.d and /etc/rc6.d ...but I'm not sure what is really going on here ...

Thanks

Some flavours of Linux have their own ideas about Startup and Shutdown scripts.

For example - on SuSE Linux, changing runlevel from, say, runlevel 5 to runlevel 0 involves executing the K* scripts in the runlevel 5 directory before it leaves runlevel 5 for runlevel 0, which is different to traditional *nix.... So what you'll need to do is execute

ln -s /etc/init.d/dbora /etc/rc3.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc4.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc5.d/K10dbora

and that should fix it..

Think about it like this (for SuSE Linux, anyways ;)) - on entering runlevel X, the S* scripts in rcX.d are excuted. On leaving runlevel X, the K* scripts in rcX.d are executed.

Cheers
ZB