Current File : //etc/init.d/sv.cluster
#!/usr/bin/ksh
#
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
#

if [ ! -d /usr/sbin -o ! -d /usr/bin ]
then
	exit 1
fi

# Constants

SVBOOT=/usr/sbin/svboot
SVCS=/usr/bin/svcs
SVCS_NAME=system/nws_sv:cluster

# Functions

# main program

# Determine if SMF service is online
#
ONLINE=`$SVCS -D $SVCS_NAME 2>>/dev/null | grep "^online"`
if [ -z $ONLINE ]
then
	echo "$SVCS_NAME not online"
	exit 1
fi

if [[ ! -x $SVBOOT ]]
then
	echo "$0: cannot find $SVBOOT"
	exit 1
fi

if [[ -z "$2" ]]
then
	opt=usage
else
	opt=$1
fi

case "$opt" in
'start')
	$SVBOOT -C "$2" -r
	;;

'stop')

	$SVBOOT -C "$2" -s
	;;

*)
	echo "Usage: $0 { start | stop } cluster_resource"
	exit 1
	;;
esac