#!/bin/sh
# $Id$
#
# Script:	template
#
# Description:	Basic template for all service scripts
#		Modify as required and rename to S01 - S99 (for example S33oracle, S45nfs...) 
#
# Platform:	All
#
# Author:	High-Availability.Com Ltd
#

#
# standard variables and functions
#
. /opt/HAC/bin/rsf.sh

service=${RSF_SERVICE:-"service_name"}	# edit for pre-1.3 releases

script="`basename $0`"

#
# args: <start|stop> [no_of_attempts]
#
state=$1		# starting or stopping?
attempts=${2:-'1'}	# no of attempts at this action

#
# you may or may not want this test
#
if [ ${attempts} -gt 3 ]; then
	# fail after three goes
	dated_echo "${service}: Too many retries on ${state}, aborting"
	exit ${RSF_ABORT}	# abort code
fi

#
# decide action based on first argument
#
case "${state}" in

'start')
	dated_echo "Starting"
	#
	# startup commands here
	#
	;;

'stop')
	dated_echo "Stopping"
	#
	# shutdown commands here
	#
	;;

*)
	echo "Usage: $0 <start|stop>"
	exit ${RSF_WARN}	# warning code
	;;

esac

exit ${RSF_OK}	# OK code (default)
