#!/bin/sh
# $Id$
#
# Script:	S80app
#
# Description:	Generic application startup/shutdown script
#		Modify as required for your application
#

service="SERVICE_NAME"

script="$0"
state=$1		# starting or stopping?
attempts=${2:-'1'}	# no of attempts at this action


# function for log mesg
dated_echo()
{
	date_now=`date +'%b %d %H:%M:%S'`
	echo "${date_now} `uname -n` ${script}[$$]: $*"
}

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

case "${state}" in

'start')
	dated_echo "${service}: Starting application"
	#
	# application startup commands here
	#
	;;

'stop')
	dated_echo "${service}: Stopping application"
	#
	# application shutdown commands here
	#
	;;

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

esac

exit ${RSF_OK}	# OK code (default)
