configuring a service

Michael Velez mikev777 at hotmail.com
Mon Aug 22 18:28:11 UTC 2005


----- Original Message ----- 
From: "drumil narayan" <drumilnarayan at yahoo.com>
To: "Getting started with Red Hat Linux" <redhat-install-list at redhat.com>
Sent: Monday, August 22, 2005 10:50 AM
Subject: configuring a service


> Dear All,
>
> I have a configured a service oraclewhich will start
> and stop the database.
> this service works finw while starting/rebooting the
> database and do not gets displayed while am shutting
> down the linux server.
> how do i achieve this.
>
> my oracle service is in /etc/rc.d/oracle
> symbolic links to this service are present
> /etc/rc.d/rc.0, /etc/rc.d/rc.2, rc.3, rc.6
>
> am i supposed to somthing else..
>
> kindly communicate..Drumil

It sounds like you haven't created a lock file in your oraclewhich script. 
If you haven't, do the following:

    - add the following line at the end of the start) section of your 
oraclewhich script:

touch /var/lock/subsys/oraclewhich

    - add the following line at the end of the stop) section:

rm -f /var/lock/subsys/oraclewhich

These two lines are important because if the rc script does not find the 
oraclewhich lockfile when it's preparing to kill the service, it will assume 
it's not running and will not execute oraclewhich, which is probably why you 
don't see it displayed when it's shutting down.

Be careful though as I've seen some sample Oracle startup/shutdown scripts 
(in Oracle documentation) that intentionally recurse and call themselves, 
changing the user id to oracle, in order to execute dbstart and dbshut as 
the oracle user.  In that case, the above touch command will most likely 
fail, since, I believe, you need to be root to add a lockfile.  Instead, do 
not recurse (which I don't personally like for shell scripts anyway) and use 
the "su -c" command when calling dbstart and dbshut.

Also, rather than creating the symbolic links manually, you can use the 
chkconfig tool to configure the service.  To do that do the following:

    - put the oraclewhich script in /etc/init.d instead of its own 
directory, since that's where all other startup/shutdown scripts are found.

    - in the oraclewhich script, add the following lines to your script, 
after the initial shell line:

#
# chkconfig: 2345 99 01
#
# Description: This file starts and stops all Oracle databases (and 
Listener)
#

    - in /etc/init.d, execute the following command as root:

chkconfig --add oraclewhich

You can verify the command has been accepted by typing:

chkconfig --list oraclewhich

This will create the symbolic link S99oraclewhich in rc2.d-rc5.d and the 
symbolic link K01oraclewhich in rc0.d and rc6.d.

If you haven't done so already, it would be a good idea to start/stop the 
Oracle Listener in oraclewhich as well.

Michael




More information about the Redhat-install-list mailing list