#!/bin/sh
#
#	$Id: heartbeat.in,v 1.33.2.1 2004/04/20 05:05:28 alan Exp $
#
# heartbeat     Start high-availability services
#
# Author:       Alan Robertson	<alanr@unix.sh>
#
#		This script works correctly under SuSE, Debian,
#		Conectiva, Red Hat and a few others.  Please let me know if it
#		doesn't work under your distribution, and we'll fix it.
#		We don't hate anyone, and like for everyone to use
#		our software, no matter what OS or distribution you're using.
#
# chkconfig: 2345 75 05
# description: Startup script high-availability services.
# processname: heartbeat
# pidfile: /var/run/heartbeat.pid
# config: /etc/ha.d/ha.cf
#
### BEGIN INIT INFO
# Description: heartbeat is a basic high-availability subsystem.
#	It will start services at initialization, and when machines go up
#	or down.  This version will also perform IP address takeover using
#	gratuitous ARPs.  It works correctly for a 2-node configuration,
#	and is extensible to larger configurations.
#	
#	It implements the following kinds of heartbeats:
#		- Bidirectional Serial Rings ("raw" serial ports)
#		- UDP/IP broadcast (ethernet, etc)
#		- UDP/IP multicast (ethernet, etc)
#		- Unicast heartbeats
#		- "ping" heartbeats (for routers, switches, etc.)
#	   	(to be used for breaking ties in 2-node systems
#		 and monitoring networking availability)
#
# Short-Description: High-availability services.
# Required-Start: $network $time $syslog
# Required-Stop: $network $time $syslog
# Default-Start: 3 5
# Default-Stop: 0 6
### END INIT INFO


HA_DIR=/etc/ha.d; export HA_DIR
CONFIG=$HA_DIR/ha.cf
. $HA_DIR/shellfuncs

LOCKDIR=/var/lock/subsys
RUNDIR=/var/run

if
  [ -r /etc/SuSE-release ]
then
  # rc.status is new since SuSE 7.0
  [ -r /etc/rc.status ] && . /etc/rc.status
  [ -r /etc/rc.config ] && . /etc/rc.config

  # Determine the base and follow a runlevel link name.
  base=${0##*/}
  link=${base#*[SK][0-9][0-9]}

fi
if
  [ -z "$rc_done" ]
then
  rc_done="Done."
  rc_failed="Failed."
  rc_skipped="Skipped."
fi


# exec 2>>/var/log/ha-debug

#	This should probably be it's own autoconf parameter
#	because RH has moved it from time to time...
#	and I suspect Conectiva and Mandrake also supply it.

DISTFUNCS=/etc/rc.d/init.d/functions
PROC_HA=$HA_BIN/ha.o
SUBSYS=heartbeat
INSMOD=/sbin/insmod
US=`uname -n`

# Set this to a 1 if you want to automatically load kernel modules
USE_MODULES=1

[ -x $HA_BIN/heartbeat ] || exit 0

#
#	Some environments like it if we use their functions...
#
if
  [ ! -x $DISTFUNCS ]
then
  # Provide our own versions of these functions
  status() {
	$HA_BIN/heartbeat -s
  }
  echo_failure() {
      EchoEsc " Heartbeat failure [rc=$1]. $rc_failed"
      return $1
  }
  echo_success() {
	: Cool!  It started!
      EchoEsc "$rc_done"
  }
else
  . $DISTFUNCS
fi

#
#	See if they've configured things yet...
#
if
  [ ! -f $CONFIG ]
then
  EchoNoNl "Heartbeat not configured: $CONFIG not found."
  echo_failure 1
  exit 0
fi

init_watchdog() {
  if
    [  -f /proc/devices -a  -x $INSMOD ]
  then
    init_watchdog_linux
  fi
}

#
#	Install the softdog module if we need to
#
init_watchdog_linux() {
#
# 	We need to install it if watchdog is specified in $CONFIG, and
#	/dev/watchdog refers to a softdog device, or it /dev/watchdog
#	doesn't exist at all.
#
#	If we need /dev/watchdog, then we'll make it if necessary.
#
#	Whatever the user says we should use for watchdog device, that's
#	what we'll check for, use and create if necessary.  If they misspell
#	it, or don't put it under /dev, so will we.
#	Hope they do it right :-)
#
#
  insmod=no
  # What do they think /dev/watchdog is named?
  MISCDEV=`grep ' misc$' /proc/devices | cut -c1-4`
  MISCDEV=`Echo $MISCDEV`
  WATCHDEV=`ha_parameter watchdog`
  WATCHDEV=`Echo $WATCHDEV`
  if
    [ "X$WATCHDEV" != X ]
  then
    : Watchdog requested by $CONFIG file
  #
  #	We try and insmod the module if there's no dev or the dev exists
  #	and points to the softdog major device.
  #
    if
      [ ! -c "$WATCHDEV" ]
    then
      insmod=yes
    else
      case `ls -l "$WATCHDEV" 2>/dev/null` in
      *$MISCDEV,*)
	    insmod=yes;;
      *)	: "$WATCHDEV isn't a softdog device (wrong major)" ;;
      esac
    fi
  else
    : No watchdog device specified in $CONFIG file.
  fi
  case $insmod in
    yes)
      if
        grep softdog /proc/modules >/dev/null 2>&1 
      then
        : softdog already loaded
      else
        $INSMOD softdog nowayout=0 >/dev/null 2>&1
      fi;;
  esac
  if
    [ "X$WATCHDEV" != X -a ! -c "$WATCHDEV" -a $insmod = yes ]
  then
    minor=`cat /proc/misc | grep watchdog | cut -c1-4`
    mknod -m 600 $WATCHDEV c $MISCDEV $minor
  fi
} # init_watchdog_linux()


#
#	Start the heartbeat daemon...
#

start_heartbeat() {
  if
    ERROR=`$HA_BIN/heartbeat 2>&1`
  then
    : OK
  else
    return $?
  fi
}


#
#	Start Linux-HA
#

StartHA() {
  EchoNoNl "Starting High-Availability services: "
  $HA_BIN/ResourceManager verifyallidle
  if
    [ $USE_MODULES = 1 ]
  then
    #	Create /dev/watchdog and load module if we should
    init_watchdog
  fi
  rm -f $RUNDIR/ppp.d/*
  if
    [  -f $HA_DIR/ipresources -a ! -f $HA_DIR/haresources ]
  then
    mv $HA_DIR/ipresources $HA_DIR/haresources
  fi
  #	Start heartbeat daemon
  if
    start_heartbeat
  then
    echo_success
    return 0 
  else
    RC=$?
    echo_failure $RC
    if [ ! -z "$ERROR" ]; then
      Echo
      Echo "$ERROR"
    fi 
    return $RC
  fi
}

#
#	Ask heartbeat to stop.  It will give up its resources...
#
StopHA() {
  EchoNoNl "Stopping High-Availability services: "

  if
    $HA_BIN/heartbeat -k &> /dev/null	# Kill it
  then
    echo_success
    return 0
  else
    RC=$?
    echo_failure $RC
    return $RC
  fi
}

StatusHA() {
  $HA_BIN/heartbeat -s
}

StandbyHA() {
  auto_failback=`ha_parameter auto_failback | tr 'A-Z' 'a-z'`
  nice_failback=`ha_parameter nice_failback | tr 'A-Z' 'a-z'`

  case "$auto_failback" in
    *legacy*)	echo "auto_failback is set to legacy.  Cannot enter standby."
		exit 1;;
  esac
  case "$nice_failback" in
    *off*)	echo "nice_failback is disabled.  Cannot enter standby."
		exit 1;;
  esac
  case "${auto_failback}${nice_failback}" in
    "")	echo "auto_failback defaulted to legacy.  Cannot enter standby."
		exit 1;;
  esac

  echo "auto_failback: $auto_failback"
  if
    StatusHA >/dev/null 2>&1
  then
    EchoNoNl "Attempting to enter standby mode"
    if
      $HA_BIN/hb_standby
    then
      # It's impossible to tell how long this will take.
      echo_success
    else
      echo_failure $?
    fi
  else
    Echo "Heartbeat is not currently running."
    exit 1
  fi
}

#
#	Ask heartbeat to restart.  It will *keep* its resources
#
ReloadHA() {
  EchoNoNl "Reloading High-Availability services: "

  if
    $HA_BIN/heartbeat -r # Restart, and keep your resources
  then
    echo_success
    return 0
  else
    RC=$?
    echo_failure $RC
    return $RC
  fi
}

RunStartStop() {
  # Run pre-startup script if it exists
  if
    [  -f $HA_DIR/resource.d/startstop ]
  then
    $HA_DIR/resource.d/startstop  "$@"
  fi
}

RC=0
# See how we were called.

case "$1" in
  start)
	RunStartStop pre-start
	StartHA
	RC=$?
	Echo
	if
	  [ $RC -eq 0 ]
	then
	  [ ! -d $LOCKDIR ] && mkdir -p $LOCKDIR
	  touch $LOCKDIR/$SUBSYS
	fi
	RunStartStop post-start $RC
	;;

  standby)
	StandbyHA
        RC=$?;;

  status)
	StatusHA
	RC=$?;;

  stop)
	RunStartStop "pre-stop"
	StopHA
	RC=$?
	Echo
        if
          [ $RC -eq 0 ]
        then
          rm -f $LOCKDIR/$SUBSYS
        fi
        RunStartStop post-stop $RC
	;;

  restart)
        sleeptime=`ha_parameter deadtime`
	StopHA
	Echo
	EchoNoNl Waiting to allow resource takeover to complete:
	sleep $sleeptime
	sleep 10 # allow resource takeover to complete (hopefully).
	echo_success
	Echo
	StartHA
	Echo
	;;

  force-reload|reload)
	ReloadHA
	Echo
	RC=$?
	;;

  *)
	Echo "Usage: $0 {start|stop|status|restart|reload|force-reload}"
	exit 1
esac

exit $RC
#
#
#  $Log: heartbeat.in,v $
#  Revision 1.33.2.1  2004/04/20 05:05:28  alan
#  Backported everything from 1.3.0 to 1.2.1
#
#  Revision 1.34  2004/03/19 16:32:18  alan
#  Put in a fix which causes us to always load the watchdog timer module with nowayout=0
#
#  Revision 1.33  2004/02/08 09:32:30  alan
#  Fixed the standby option in the init script to handle the switch to
#  auto_failback correctly.
#
#  Revision 1.32  2004/01/20 15:35:09  alan
#  Removed some old SuSE-isms from the init script.
#
#  Revision 1.31  2003/08/13 04:36:56  alan
#  Put in a minor change from Tuomo Soini.
#
#  Revision 1.30  2003/06/16 03:50:48  alan
#  Fixed up the default start/stop levels for heartbeat
#
#  Revision 1.29  2003/05/08 19:46:32  alan
#  Fixed an init script incompatibility with current SuSE releases pointed out by
#  Markus Markert <mma@suchtreffer.de>.
#
#  Revision 1.28  2003/04/30 19:24:49  alan
#  Fixed a spelling error pointed out by Ozan Eren Bilgen <mavi@gsu.linux.org.tr>
#
#  Revision 1.27  2003/02/21 13:41:01  alan
#  Minor comment changes to the heartbeat init script.
#
#  Revision 1.26  2003/02/20 01:26:42  horms
#  Fixed problem with Description: feild.
#  Tuomo Soini reported an undisclosed problem with the current format
#  on an undisclosed version of Redhat. The change appears not to
#  go against LSB 1.3.0[*] which Alan modified this file to conform with the
#  other day.
#
#  [*] http://www2.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/initscrcomconv.html
#
#  Revision 1.25  2003/02/19 17:50:20  alan
#  Fixed a minor comment bug pointed out by LMB.
#
#  Revision 1.24  2003/02/18 04:32:09  alan
#  Added some comments to the heartbeat init script necessary for LSB
#  compatibility.
#
#  Revision 1.23  2002/10/21 10:17:18  horms
#  hb api clients may now be built outside of the heartbeat tree
#
#  Revision 1.22  2002/10/15 13:41:31  alan
#  Switched heartbeat over to use the GSource library functions.
#  Added the standby capability to the heartbeat init script
#  Changed the proctrack library code to use cl_log() instead of g_log().
#  Removed a few unused header files.
#
#  Revision 1.21  2002/10/11 03:13:09  horms
#  Minor cleanup of output from a "restart"
#
#  Revision 1.20  2002/10/09 18:37:07  msoffen
#  Left call directly to startstop script instead of the wrapper function.
#
#  Revision 1.19  2002/10/09 18:35:54  msoffen
#  Created pre-start, pre-stop, post-stop, and pre-stop constructs in startstop and
#  moved startstop to documents (to not override).
#
#  Revision 1.18  2002/09/20 02:13:20  horms
#  Tidied up the output for the restart and reload targets.
#  This follows what is done for start and stop.
#  Works fine on RedHat 7.2. Hopefully it won't break anything/much else.
#
#  Revision 1.17  2002/09/10 15:54:57  msoffen
#  Added call on startup (if startstop scrip exists) to startstop script (not
#  resource based - heartbeat startup/shutdown based).
#
#  Revision 1.16  2002/08/12 14:37:53  msoffen
#  Replaced the last echononl with EchoNoNl.
#
#  Revision 1.15  2002/04/03 20:02:21  alan
#  Made the init starting and stopping priorities into autoconf variables.
#  They default to 75 and 5 respectively.  They should probably be overridden for
#  SuSE in the ConfigureMe script.
#
#  Revision 1.14  2002/04/02 19:40:36  alan
#  Failover was completely broken because of a typo in the configure.in file
#  Changed the run level priorities so that heartbeat starts after
#  drbd by default.
#  Changed it so that heartbeat by default runs in init level 5 too...
#
#  Fixed a problem which happened when both nodes started about simultaneously.
#  The result was that hb_standby wouldn't work afterwards.
#
#  Raised the debug level of some reasonably verbose messages so that you can
#  turn on debug 1 and not be flooded with log messages.
#
#  Changed the code so that in the case of nice_failback there is no waiting for
#  the other side to give up resources, because we negotiate this in advance.
#  It gets this information through and environment variable.
#
#  Revision 1.13  2002/03/21 02:03:00  alan
#  Added locking to the assignment of interfaces in IPaddr.
#
#  Revision 1.12  2002/03/05 21:13:06  alan
#  Put in fix suggested by Joo Miguel P. S <joao-m-sa@ptinovacao.pt>
#  to use grave accents instead of the silly bash notation.
#
#  Revision 1.11  2001/11/26 14:04:41  horms
#  Log to stdout that <path>/ha.cf is missing if init script exits for that reason.
#  (Horms)
#
#  Revision 1.10  2001/10/25 16:12:06  alan
#  Put in a portability change on path names...
#
#  Revision 1.9  2001/10/25 15:00:27  alan
#  Put in naming patch from Matt Soffen for heartbeat.in
#
#  Revision 1.8  2001/10/24 20:46:29  alan
#  A large number of patches.  They are in these categories:
#  	Fixes from Matt Soffen
#  	Fixes to test environment things - including changing some ERRORs to
#  		WARNings and vice versa.
#  	etc.
#
#  Revision 1.7  2001/10/13 09:42:51  alan
#  Incorporated a small patch from Matt Soffen
#
#  Revision 1.6  2001/10/07 03:58:10  alan
#  Fixed up the 'echo' code in rc script so that it's portable.
#  The 'shellfuncs' function library now have Echo EchoEsc and EchoNoNl functions
#  in it.  They are supposed to work on any OS.
#
#  Revision 1.5  2001/10/05 22:56:01  alan
#  Added another missing portability feature...
#
#  Revision 1.4  2001/10/05 22:48:05  alan
#  Fixed the spelling of the echoesc and echononl shell functions.
#
#  Revision 1.3  2001/10/05 22:38:06  alan
#  Put in some code to make us more portable.
#
#  Revision 1.2  2001/06/28 20:35:00  alan
#  Patch from Juri to install our scripts with paths patched appropriately.
#
#  Revision 1.1  2001/06/28 14:21:40  alan
#  Added heartbeat.in and removed 2 Makefile.in's as per Juri Haberland
#  Ypdated .cvsignore files...
#
#  Revision 1.1  2001/05/09 23:21:21  mmoerz
#  autoconf & automake & libtool changes
#
#  * following directories have been added:
#
#    - config	will contain autoconf/automake scripts
#    - linux-ha	contains config.h which is generated by autoconf
#  		will perhaps some day contain headers which are used throughout
#  		linux-ha
#    - replace	contains as the name implies replacement stuff for targets
#  		where specific sources are missing.
#
#  * following directories have been added to make a split up between c-code
#    and shell scripts and to easy their installation with automake&autoconf
#
#    - heartbeat/init.d		containment of init.d script for heartbeat
#    - heartbeat/logrotate.d	containment of logrotate script for heartbeat
#
#    - ldirectord/init.d		similar to heartbeat
#    - ldirectord/logrotate.d	similar to heartbeat
#
#  * general changes touching the complete repository:
#
#    - all Makefiles have been replaced by Makefile.ams.
#
#    - all .cvsingnore files have been enhanced to cope with the dirs/files
#      that are added by automake/autoconf
#      Perhaps it would be a nice idea to include those files, but the sum
#      of their size if beyond 100KB and they are likely to vary from
#      automake/autoconf version.
#      Let's keep in mind that we will have to include them in distribution
#      .tgz anyway.
#
#    - in dir replace setenv.c was placed to available on platform where
#      putenv() has to be used since setenv is depricated (better rewrite
#      code -> to be done later)
#
#  * following changes have been made to the files of linux-ha:
#
#    - all .cvsignore files have been changed to ignore files generated by
#      autoconf/automake and all files produced during the build-process
#
#    - heartbeat/heartbeat.c:	added #include <config.h>
#
#    - heartbeat/config.c:		added #include <config.h>
#
#  * following files have been added:
#     - Makefile.am: see above
#     - configure.in: man autoconf/automake file
#     - acconfig.h: here are additional defines that are needed for
#  		 linux-ha/config.h
#     - bootstrap: the shell script that 'compiles' the autoconf/automake script
#  		into a useable form
#     - config/.cvsignore: no comment
#     - doc/Makefile.am: no comment
#     - heartbeat/Makefile.am: no comment
#     - heartbeat/lib/Makefile.am: no comment
#     - heartbeat/init.d/.cvsignore: no comment
#     - heartbeat/init.d/heartbeat: copy of hearbeat/hearbeat.sh
#     - heartbeat/init.d/Makefile.am: no comment
#     - heartbeat/logrotate.d/.cvsignore: no comment
#     - heartbeat/logrotate.d/Makefile.am: no comment
#     - heartbeat/logrotate.d/heartbeat: copy of hearbeat/heartbeat.logrotate
#     - heartbeat/rc.d/Makefile.am: no comment
#     - heartbeat/resource.d/Makefile.am: no comment
#     - ldirectord/Makefile.am: no comment
#     - ldirectord/init.d/Makefile.am: no comment
#     - ldirectord/init.d/.cvsignore: no comment
#     - ldirectord/init.d/ldiretord: copy of ldirectord/ldirectord.sh
#     - ldirectord/logrotate.d/Makefile.am: no comment
#     - ldirectord/logrotate.d/.cvsignore: no comment
#     - ldirectord//ldiretord: copy of ldirectord/ldirectord.logrotate
#     - linux-ha/.cvsignore: no comment
#     - replace/.cvsignore: no comment
#     - replace/setenv.c: replacement function for targets where setenv is missing
#     - replace/Makefile.am: no comment
#     - stonith/Makefile.am: no comment
#
#  Revision 1.35  2001/02/25 18:45:59  alan
#  Changed the watchdog code to use the new ha_parameter function.
#
#  Revision 1.34  2001/02/25 18:39:58  alan
#  Added code to sleep for "enough" seconds during a restart to ensure that
#  takeover happens like it should.
#
#  Revision 1.33  2001/02/07 07:10:20  alan
#  Added code to verify that all resources are idle when starting heartbeat.
#
#  Revision 1.32  2000/12/23 05:08:59  horms
#  Cleaned up debian flims
#
#  Revision 1.31  2000/12/20 16:54:41  alan
#  Changed "restart" in heartbeat to actually do a stop followed by a start.
#  Reload still does the no-failover reload operation.
#
#  Revision 1.30  2000/11/25 13:07:44  alan
#  Fixed a minor bug in the heartbeat startup script for SuSE.
#  Replaced the makefile with a correct version after it was slammed with
#  a new/old version by someone who is Debianizing it.
#
#  Revision 1.29  2000/11/17 13:28:46  alan
#  Made the code slightly more SuSE-friendly in its messages.
#  Increased the release number :-)
#
#  Revision 1.28  2000/08/01 12:25:59  alan
#  Yet another few comment changes...
#
#  Revision 1.27  2000/08/01 12:25:05  alan
#  More political comment changes...
#
#  Revision 1.26  2000/08/01 12:21:55  alan
#  Some comment changes.
#
#  Revision 1.25  2000/06/21 04:34:48  alan
#  Changed henge.com => linux-ha.org and alanr@henge.com => alanr@suse.com
#
#  Revision 1.24  2000/06/12 22:07:59  alan
#  Spelling correction in a comment.
#
#  Revision 1.23  2000/06/12 22:06:30  alan
#  Finished updating the code for restart.
#
#  Revision 1.22  2000/06/12 22:03:11  alan
#  Put in a fix to the link status code, to undo something I'd broken, and also to simplify it.
#  I changed heartbeat.sh so that it uses the -r flag to restart heartbeat instead
#  of stopping and starting it.
#
#  Revision 1.21  2000/06/12 06:11:09  alan
#  Changed resource takeover order to left-to-right
#  Added new version of nice_failback.  Hopefully it works wonderfully!
#  Regularized some error messages
#  Print the version of heartbeat when starting
#  Hosts now have three statuses {down, up, active}
#  SuSE compatability due to Friedrich Lobenstock and alanr
#  Other minor tweaks, too numerous to mention.
#
#  Revision 1.20  2000/04/27 12:50:20  alan
#  Changed the port number to 694.  Added the pristene target to the ldirectord
#  Makefile.  Minor tweaks to heartbeat.sh, so that it gives some kind of
#  message if there is no configuration file yet.
#
#  Revision 1.19  2000/04/24 07:08:13  horms
#  Added init script to ldirectord, fixed hearbeat.sh to work with RH6.2 again, heartbeat.sh now aborts if /etc/ha.d/ha.cf is not present. Added sample ldirectord.cf. Moved logging directives to the top of the sample ha.cf. Incremented version in master Makefile to 0.4.7apre2. KERNELDIRS now don't get any treatment in the master makefile, this is to fix a bug (introduced by me) with using an emty  in a for i in  under some shells
#
#  Revision 1.18  2000/04/24 06:34:45  horms
#  Made init work cleanly with RH 6.2 again
#
#  Revision 1.17  2000/04/23 13:16:17  alan
#  Changed the code in heartbeat.sh to no longer user RH's daemon or
#  killproc functions.
#
#  Revision 1.16  2000/04/03 08:26:29  horms
#
#
#  Tidied up the output from heartbeat.sh (/etc/rc.d/init.d/heartbeat)
#  on Redhat 6.2
#
#  Loging to syslog if a facility is specified in ha.cf is instead of
#  rather than as well as file logging as per instructions in ha.cf
#
#  Fixed a small bug in shellfunctions that caused logs to syslog
#  to be garbled.
#
#  Revision 1.15  1999/11/11 06:02:43  alan
#  Minor change to make heartbeat default enabled on startup.
#
#  Revision 1.14  1999/11/11 05:48:52  alan
#  Added code to start up heartbeat automatically.
#
#  Revision 1.13  1999/10/19 13:55:36  alan
#  Changed comments about being red hat compatible
#  Also, changed heartbeat.c to be both SuSE and Red Hat compatible in it's -s
#  output
#
#  Revision 1.12  1999/10/19 01:56:51  alan
#  Removed the sleep between shutdown and startup, since that's now in
#  heartbeat itself.
#
#  Revision 1.11  1999/10/19 01:49:10  alan
#  Put in a sleep between stop and start in restart to make it more reliable.
#
#  Revision 1.10  1999/10/10 19:45:21  alanr
#  Changed comment
#
#  Revision 1.9  1999/10/05 05:17:49  alanr
#  Added -s (status) option to heartbeat, and used it in heartbeat.sh...
#
#  Revision 1.8  1999/10/05 04:35:26  alanr
#  Changed it to use the new heartbeat -k option to shut donw heartbeat.
#
#  Revision 1.7  1999/10/04 03:12:39  alanr
#  Shutdown code now runs from heartbeat.
#  Logging should be in pretty good shape now, too.
#
#  Revision 1.6  1999/10/04 01:47:22  alanr
#  Fix the problem reported by Thomas Hepper with the code for loading the watchdog
#  device correctly.
#
#  Revision 1.5  1999/10/03 03:14:04  alanr
#  Moved resource acquisition to 'heartbeat', also no longer attempt to make the FIFO, it's now done in heartbeat.  It should now be possible to start it up more readily...
#
#  Revision 1.4  1999/10/02 17:48:08  alanr
#  Put back call to init_fifo.  Thanks to Thomas Hepper
#
#  Revision 1.3  1999/10/02 04:59:22  alanr
#  FreeBSD mkfifo cleanup
#
#  Revision 1.2  1999/09/23 15:53:13  alanr
#
#  First version to work :-)
#  Got this first version to work...
#
#  Revision 1.1.1.1  1999/09/23 15:31:24  alanr
#  High-Availability Linux
#
#  Revision 1.12  1999/09/14 23:07:09  alanr
#  another comment change...
#
#  Revision 1.11  1999/09/14 23:05:13  alanr
#  comment change...
#
#  Revision 1.10  1999/09/14 22:32:50  alanr
#  Put in Thomas Hepper's fix for killproc.
#  Lots of other changes I think...
#
#  Revision 1.9  1999/09/07 04:46:34  alanr
#  made it exit with proper return codes.
#  Also, moved things around according to the FHS...
#
#  Revision 1.8  1999/08/22 04:10:37  alanr
#  changed the name of this file to heartbeat.sh.
#  Also moved the change log to the end of the file...
#
#  Revision 1.7  1999/08/22 04:03:13  alanr
#  Merged this file with the heartbeat script as suggested by Guenther Thomsen
#
#  Revision 1.6  1999/08/21 21:54:12  alanr
#  Restructured the code in preparation for combining this script with the
#  init script under /etc/rc.d/init.d.
#
#  Revision 1.5  1999/08/17 04:34:53  alanr
#  added code to create /dev/watchdog and load softdog if necessary...
#
#
