2

I created a script called blueBoxT for starting and stopping Oracle and placed it in the /etc/init.d directory.

#!/bin/bash
echo "blueBoxT $1 - `date '+%Y%m%d%H%M'`" >> /root/blueBoxT.log
case "$1" in
  'start')
    echo "Starting Oracle"
    su - oracle -c "/home/oracle/startDBT"
    ;;
  'stop')
    echo "Stopping Oracle"
    su - oracle -c "/home/oracle/stopDBT"
    ;;
  *)
    echo "`basename $0`: usage: `basename $0` { stop | start }"
    ;;
esac
exit 0

I made the symbolic links as so...

root@dev /etc/rc.d
# find . -name *blueBox*
./rc2.d/K11blueBox
./rc6.d/K11blueBox
./init.d/blueBoxT
./rc1.d/K11blueBox
./rc3.d/S97blueBox
./rc0.d/K11blueBox
./rc5.d/S97blueBox
./rc4.d/S97blueBox

The log at /root/blueBoxT.log shows the start command and the Oracle instance is up.

The stop command never appears to get called. It is not in my log.

root@dev /root
# cat blueBoxT.log
blueBoxT start - 201008051323
blueBoxT start - 201008051327
blueBoxT start - 201008051346
blueBoxT start - 201008051356

I shutdown my Fedora 10 using the command...

shutdown -h now

What have I misconfigured to not be receiving the stop so that I can do an orderly shutdown of Oracle?

dacracot
  • 469
  • 2
  • 12
  • 28

1 Answers1

5

I don't have that version of Fedora but for RHEL5 the important part of /etc/rc.d/rc is:

subsys=${i#/etc/rc$runlevel.d/K??}
[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
        || continue

Your problem may be that you don't touch a /var/lock/subsys/blueBox when starting.

Also the file in init.d is called blueBoxT whereas your rc?.d scripts are called K??blueBox (no trailing T) which is confusing.

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47
  • 1
    K?? and S?? files in `/rc?.d` scripts are just symlinks back to the `/etc/init.d` script. They don't have to be named the same in fact due to the K??|S?? part they can't be named the same. – Zypher Aug 05 '10 at 22:50
  • +1, make sure to touch the lock files – James Aug 05 '10 at 22:50
  • I corrected the "missing T", but I don't think that was the problem. The lock seems to have done the trick! – dacracot Aug 05 '10 at 23:15