#!/bin/sh
#
#	$Id: heartbeat.in,v 1.25.2.3 2003/08/13 16:44:41 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: 2 3 4 5
# Default-Stop: 0 1 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


### MERU part
PROC=/usr/lib/heartbeat/heartbeat

START_DELAY=.2

MNAME=`basename $PROC`
PIDFILE=/var/run/${MNAME}.pid
LOG=/opt/wlan/var/log/${MNAME}.log
FIFOF=/var/lib/heartbeat/fifo

if [ -f /etc/init.d/meru-functions ]; then
	. /etc/init.d/meru-functions
else
	echo "/etc/init.d/meru-functions must exist to use $0"; exit 1
fi

#### END MERU


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]}

  # Force execution if not called by a runlevel directory.
  test "$link" = "$base" && START_HEARTBEAT=yes
  test "$START_HEARTBEAT" = yes || exit 0
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


# Fix for Bug ID 25581
# The reason for monit exe not found is that the PATH is getting
# reset when we call $DISTFUNCS.
# One more approach is to include the meru-functions over here 
# Right now we can live with this.

PATH=$PATH:/opt/meru/bin
export PATH

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

#
#	Start the heartbeat daemon...
#
start_heartbeat() {
    echo "starting $HA_BIN/heartbeat" >> $LOG
    $HA_BIN/heartbeat >> $LOG 2>&1
    echo "RETURN VALUE =    $?" >> $LOG
    if [ $? = 0 ]; then
    	return 1
    else
   	return 0
    fi
}

#
#	Start Linux-HA
#
StartHA() {

    vrfy_combo `cat $PIDFILE 2>/dev/null` && {
        return
    }

    echo "============ $0 start =================" >> $LOG
    cd /opt/wlan/etc

    EchoNoNl "Starting High-Availability services: "
    $HA_BIN/ResourceManager verifyallidle

    rm -f $RUNDIR/ppp.d/*
    if [  -f $HA_DIR/ipresources -a ! -f $HA_DIR/haresources ]; then 
        mv $HA_DIR/ipresources $HA_DIR/haresources
    fi

    # find shared ip from config file 
    SHARED_IP=`sed -e "1,83d" -e "85,1000d" /etc/ha.d/haresources |  awk '{print $2}'`

    [ "$SHARED_IP" ] && {

        # write shared ip to atsvif
        echo "share-ip $SHARED_IP" > /proc/meru/atsvif/config 

        # write shared ip to kcomm 
        echo "ha_sharedip $SHARED_IP" > /proc/meru/kcomm/rt_config 
    } 

    # Start heartbeat daemon
    if start_heartbeat
    then
        vrfy `cat $PIDFILE 2>/dev/null` || {
            fail "$PROC did not start. Will try again."
        }
        
        echo_success
        return 0 
    else
        RC=$?
        echo_failure $RC
        return $RC
    fi
}

#
#	Ask heartbeat to stop.  It will give up its resources...
#
StopHA() {

    echo "============ $0 stop =================" >> $LOG

    $HA_BIN/heartbeat -k >> $LOG  2>&1
    sleep 5

    echo "Manually Killing Hearbeat" >> $LOG
    ppid=`cat $PIDFILE`
    pkill -P $ppid $MNAME
    sleep 1
    pkill -P $ppid $MNAME
    
#    pkill -P 1 $MNAME
#    sleep 1
#    pkill -P 1 -9 $MNAME
    
    die $PROC

    rm -f $PIDFILE

    # release shared ip to atsvif
    echo "share-ip 0.0.0.0" > /proc/meru/atsvif/config

    # release shared ip to kcomm 
    echo "ha_sharedip 0.0.0.0" > /proc/meru/kcomm/rt_config 

    echo_success
    return 0
}

StatusHA() {
  $HA_BIN/heartbeat -s
}

StandbyHA() {
  nice_failback=`ha_parameter nice_failback | tr "on" "ON"`
  echo "nice_failback: $nice_failback"
  if
    [ "$nice_failback" = "ON" ]
  then
    if
      StatusHA >/dev/null 2>&1
    then
      Echo "Attempting to enter standby mode."
      Echo
      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."
    fi
  else
    Echo "Standby mode requires that nice_failback be enabled."
    Echo "nice_failback is not enabled.  Cannot enter standby mode."
  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
}


MStart() {
    RunStartStop pre-start
    StartHA
    RC=$?
    Echo
    if
      [ $RC -eq 0 ]
    then
      [ ! -d $LOCKDIR ] && mkdir -p $LOCKDIR
      touch $LOCKDIR/$SUBSYS
    fi
    RunStartStop post-start $RC
}

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

RC=0
# See how we were called.

case "$1" in
    start)
        if vrfy monit; then
            echo "start called. monit present" >> $LOG
            start_with_monit $MNAME
        else
            echo "start called. monit not present" >> $LOG
            MStart      
        fi
        ;;

    mstart)
        echo `date` "mstart called. pidfile is $PIDFILE" >> $LOG
        
        # Added Fix for Bug ID 23828
        # This will kill all the child processes started by heartbeat
        # if by chance the main thread manager is killed
        # Basically we check if the $FIFOF file is used by any process and if yes
        # then we will kill that process
        # Also we will check if any process has taken up the ha-cluster(694) port
        # if yes then kill those process
        # The StatusHA has 3 return values
        # 0 - It means that the heartbeat process is running
        # 1 - It means that the $PIDFILE file is there but the heartbeat process is not running
        # 3 - It means that the heartbeat process is not running and $PIDFILE is not there
        # We use the return value 1 which means the heartbeat process was killed abnormally

        StatusHA
        RC=$?
        echo "StatusHA RESULT = $RC" >> $LOG

        case $RC in
        1)
           echo "Check for any other heartbeat process exist" >> $LOG
           cfifo=`fuser $FIFOF`
           if [ $? = 0 ]; then
              # This means there is a process which is using this file
              echo $cfifo | awk -F : '{print "kill -9 "$2}' | sh -x > /dev/null 2>&1
           fi
           cudp=`fuser ha-cluster/udp`
           if [ $? = 0 ]; then
              # This means there are process which are using ha-cluster port
              echo $cudp | awk -F : '{print "kill -9 "$2}' | sh -x > /dev/null 2>&1
           fi
        esac
        
        vrfy_combo `cat $PIDFILE 2>/dev/null` && {
		return
        }

        MERU0=`/sbin/ifconfig | grep "meru:0"`

        if [ "$MERU0" ]; then
            echo `date` "mstart called. bringing meru:0 down" >> $LOG
            /sbin/ifconfig meru:0 down
        fi
        MStart
        ;;

    standby)
        StandbyHA
        RC=$?;;

    status)
        StatusHA
        RC=$?;;

    stop)
        if vrfy monit; then
                stop_with_monit $MNAME
        else
            MStop
        fi
        ;;

    mstop)
        MStop
        ;;

    restart)
        if vrfy monit; then
            sleeptime=`ha_parameter deadtime`
            restart_with_monit $MNAME
            Echo
            EchoNoNl Waiting to allow resource takeover to complete:
            sleep $sleeptime
            sleep 10 # allow resource takeover to complete (hopefully).
            echo_success
            Echo
            echo "restart called. monit present" >> $LOG
            monit -c /opt/meru/etc/monit.conf start $MNAME
        else
            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
       	fi
        ;;

  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.25.2.3  2003/08/13 16:44:41  alan
#  Put Tuomo Soini's "-f" patch into the heartbeat init script.
#
#  Revision 1.25.2.2  2003/05/08 19:45:24  alan
#  Fixed a spelling error pointed out by Ozan Eren Bilgen <mavi@gsu.linux.org.tr>
#  Also, fixed an incompatibility with current SuSE releases pointed out by
#  Markus Markert <mma@suchtreffer.de>.
#
#  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 Jo? 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...
#
#
