Shutdown scripts

 
Thread Tools Search this Thread
Operating Systems Linux SuSE Shutdown scripts
# 1  
Old 05-11-2005
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
# 2  
Old 05-15-2005
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

Code:
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 Smilie) - 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Boot/Shutdown scripts

Server: Redhat 6.2 Goal: Startup script/Shutdown Script Overview: I'm just doing a very basic test. I'm not getting chkconfig involved. Research so far: I've found a few different ways of getting this to work, some say I can just drop the scripts in the corresponding rc directory. Others... (4 Replies)
Discussion started by: HayekSplosives1
4 Replies

2. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

3. Shell Programming and Scripting

Oracle DB Start shutdown scripts

Hi, We have a requirement wherein we do not want to share the Oracle DB sys and system passwords to be shared with the support desk. But they will be responsible for starting/shuting down the Database. Is it possible to write a shell script which will read the sys and system passwords from a... (0 Replies)
Discussion started by: narayanv
0 Replies

4. AIX

Please update inittab/rc.shutdown/rc scripts to start/stop mqm (need help Urgent)

HI i need help from seniors on this issue, i need to know how to do this, i need to update 50+ server starting saturday. below is the ticket which i have with full description. Currently MQ Series must be stopped before and started after any reboot. Not having the start/stop as part of... (2 Replies)
Discussion started by: gulamibrahim
2 Replies

5. UNIX for Dummies Questions & Answers

Script to force Oracle database shutdown when shutdown immediate does not work

I have Oracle 9i R2 on AIX 5.2. My Database is running in shared server mode (MTS). Sometimes when I shutdown the database it shutsdown cleanly in 4-5 mints and sometimes it takes good 15-20 minutes and then I get some ora-600 errors and only way to shutdown is by opening another session and... (7 Replies)
Discussion started by: aixhp
7 Replies

6. AIX

Startup/shutdown scripts in AIX

hi, If we place Sxx (startup script) and Kxx(shutdown script) in /etc/rc.d/rc2.d,then it would start and stop automatically(assume they are linked to other script that actually starts/stops). is there really a link needed here to /etc/rc.d/init.d? if not,what is the use of this directory..?... (1 Reply)
Discussion started by: to_bsr
1 Replies

7. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

8. AIX

Startup/Shutdown scripts

I understand that by putting in entries into the /etc/inittab file. We can actually call the our scripts during startup. mkitab "start_server:2:once:sh /scripts/startserver.sh" Would the system wait for startserver.sh finish executing before it goes to another entry? and how long would it... (1 Reply)
Discussion started by: vincente
1 Replies

9. Shell Programming and Scripting

Shutdown Scripts

Hi, Recently I've created a script to shutdown a few hpux workstations and I found out that the script can only shutdown 1 workstation and then exit out from the loop without shutting down the rest of the workstation. The scripts is as below (brief one): hcp_list="machine_a ... (4 Replies)
Discussion started by: zheng_soon
4 Replies

10. UNIX for Advanced & Expert Users

rc scripts, do i need to kill them on shutdown?

We have a bunch of tools, that run on linux and on unix, I've got start up scripts that bring up their license managers when the unix box boots, do I need kill scripts for when the box is shutting down? I've not seen much documentation on this, just on getting the license managers started, but... (1 Reply)
Discussion started by: kymberm
1 Replies
Login or Register to Ask a Question