#!/bin/sh
# $Id$
#
# Script:	S10apc_snmp
#
# Description:	Reboot APC (http://www.apcc.com/) UPS of sibling server
#		after failover, to force sibling disabling
#
# Platform:	Unix
#
# Author:	High-Availability.Com Ltd
#

#
# EDIT the ups line and the rs_community_string
#
ups="194.200.78.117"	# IP/name of sibling UPS on network
rw_community_string="hac-secret"	# SNMP auth
ups_reboot_oid="1.3.6.1.4.1.318.1.1.1.6.2.2.0"
#
#
#

. /opt/HAC/bin/rsf.sh

services=${RSF_SERVICE:-"servicename"}
script="`basename $0`"
state=$1

case "${state}" in

	'start')
		dated_echo "Rebooting UPS"
		snmpset -h $ups -p 161 -t 30 -i 111 -c $rw_community_string $ups_reboot_oid Integer 2 > /dev/null
		exit ${RSF_OK}
	;;

	'stop')
		exit ${RSF_OK}
	;;

	*)
		dated_echo "Usage: ${script} <start|stop>"
		exit ${RSF_WARN}
	;;

esac

