Forum OpenACS Q&A: Re: Rebooting a system using daemontools and Oracle

Collapse
Posted by Tom Jackson on

Janine, you need to kill stuff running in /service. One failing of daemontools is shutting down stuff in order, and starting up in order. I have an init.d script for this situation:


#! /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
#


touch /tmp/running_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

It's heavy handed I know, you could adjust as needed, and maybe move the touched lock file to a better location.

Collapse
Posted by Tom Jackson on

Oops, also note that for stop you might want to do a -k and then a -d, AOLserver sometimes doesn't stop on -d alone. (or better do -d and then -k).

Collapse
Posted by Tom Jackson on

Shoot, I should read my own script. Just remove the line:

touch /tmp/running_svc

That is a debug command I stuck in there and forgot to remove. The lock file is where it is supposed to be.

Collapse
Posted by Janine Ohmer on
FYI for anyone else working on this:

Tom's script didn't stop qmail.  I don't understand quite why, it could be a problem with our installation, but I'm not going to sweat it.  Adding /var/qmail/bin/qmailctl stop|start to the appropriate sections solved the problem.