#!/bin/sh
# $Id$
#
# Script:	S99notify
#
# Description:	Mail message when service started/stopped
#
# Platform:	All
#
# Author:	High-Availability.Com Ltd
#

. /opt/HAC/bin/rsf.sh

#
# EDIT
#
user="sysadmin"	# user to mail
mailcmd="mailx"	# mail command on your system

service=${RSF_SERVICE:-"service_name"}

_host="`uname -n`"
state=$1

case "${state}" in

'start')
	echo "${service} service started on ${_host}." | ${mailcmd} -s "${PROD_NAME} notification" ${user}
	exit ${RSF_OK}
	;;

'stop')
	echo "${service} service stopped on ${_host}." | ${mailcmd} -s "${PROD_NAME} notification" ${user}
	exit ${RSF_OK}
	;;

*)	echo "usage: $0 <start|stop>"
	exit ${RSF_WARN}
	;;

esac
