Forum OpenACS Q&A: Re: PostgreSQL data disappeared

Collapse
Posted by Tom Jackson on

Yeah, your boot/reboot scripts are messed up just like mine were. Sshd goes down before Oracle, so if it hangs you can't login and fix it.

Also, I can't tell but if you used the stock postgresql scripts and the stock listerner8i script, they never actually are killed.

First to correct the order of kill/startup problem:

#!/bin/sh
# 
# chkconfig: 345 98 02
# description: Oracle8i starts the oracle database deamons ...

Note changes to the chkconfig line to kill on 02 (almost first) and start on 98 (almost last). Then as root:

# chkconfig --del oracle8i
# chkconfig --add oracle8i

Repeat the same steps for listener8i and postgresql. Also these scripts probably are broken. I'll show you my svc script so you can see what needs to be in them to work correctly.

#! /bin/sh

# chkconfig: 345 99 01
# description: svc start and kill all

# This is an example of a start/stop script for SysV-style init, such
# as is used on Linux systems.  You should edit some of the variables
# and maybe the 'echo' commands.
#
# add to starup via:
# chkconfig --add svc
#


# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# What to use to start up the postmaster
DAEMON="/usr/local/bin/svc"


# Only start if we can find svc.
test -f $DAEMON || exit 0

# Parse command line parameters.
case $1 in
   start)
         echo "Starting All SVC Daemons:"
         $DAEMON -u /service/*
         touch /var/lock/subsys/svc
         echo "ok"
         ;;
   stop)
         echo -n "Stopping All SVC Daemons: "
         svc -d /service/*
         rm -f /var/lock/subsys/svc
         echo "ok"
         ;;
   restart)
         echo -n "Restarting All SVC Daemons: "
         $0 stop
         $0 start
         echo "ok"
         ;;
   status)
         svstat /service/*
         ;;
   *)
         # Print help
         echo "Usage: $0 {start|stop|restart|status}" 1>&2
         exit 1
         ;;
esac

exit 0


Add the svc script (as root):

# chkconfig --add svc

Notice the touch and rm -f lines in start and stop parts of the script. These lines were missing in my copies of listener9i and postgresql.

Also note that my script is a little aggressive, starting all scripts in /service/, even ones with the down file in their run directory. There is a definite need for improvement here for it to work according to original design.