How do you depend on Oracle in a Linux init script?
We have an init script for our application located in /etc/init.d. We will
use insserv to register it so that our application can start up
automatically when the server boots up. Right now our init script has the
following lines at the beginning:
#! /bin/sh
#
# System startup script for our app
#
### BEGIN INIT INFO
# Provides: ourapp
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Description: Our App
### END INIT INFO
We also have an /etc/init.d/dbora script that we use for Oracle:
#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/opt/oracle/product/11gR2/db
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
export ORACLE_HOME PATH
touch /var/lock/subsys/dbora
case $1 in
'start')
su - $ORACLE $ORACLE_HOME/bin/dbstart $ORACLE_HOME &
;;
'stop')
su - $ORACLE $ORACLE_HOME/bin/dbshut $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
This dbora script came from the Oracle web site and doesn't use insserv.
It told me to create the following links to automatically start up Oracle
on server bootup:
ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
So how do I have our init script start our application only after Oracle
has started up? I will need to add something to the "Required-Start"
field, but I'm not sure what to add.
No comments:
Post a Comment