Sun Cluster Data Service for Sun Grid Engine Guide for Solaris OS

Appendix A Files for Configuring and Removing Sun Cluster HA for Sun Grid Engine Resources

The /opt/SUNWscsge/util directory contains files that automate the process of configuring and removing Sun Cluster HA for Sun Grid Engine resources. Listings of these files are provided in the following sections:

Listing of sge_config

#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
# 
# ident	"@(#)sge_config	1.3	06/07/14 SMI"
#
# This file will be sourced in by sge_register and the parameters
# listed below will be used.
#
# These parameters can be customized in (key=value) form and are always needed:
#
#	QMASTERRS  - name of the resource for the sge_qmaster daemon.
#	SCHEDDRS   - name of the resource for the sge_schedd daemon.
#	MASTERRG   - name of the resource group containing the resources
#	             for sge_qmaster and sge_schedd.
#	MASTERPORT - tcp port number that sge_qmaster will listen to
#		     (normally 536).
#	MASTERLH   - name of the LogicalHostname SC resource within MASTERRG.
#	MASTERHASP - name of the HAStoragePlus SC resource within MASTERRG.
#	SGE_ROOT   - SGE_ROOT of this Sun GridEngine Installation.
#	SGE_CELL   - SGE_CELL of this Sun GridEngine Installation.
#	SGE_VER    - Version of this Sun GridEngine Installation.
#	             Currently this can only be set to 6.0 .
#

QMASTERRS=
SCHEDDRS=
MASTERRG=
MASTERPORT=536
MASTERLH=
MASTERHASP=
SGE_ROOT=
SGE_CELL=
SGE_VER=6.0

Listing of sge_register

#!/bin/ksh
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)sge_register.ksh	1.6	06/07/14 SMI"
#

MYCONFIG=""
MYNAME=`basename $0`
GDSTYPE=SUNW.gds

typeset opt

while getopts 'f:' opt
do
	case "${opt}" in
		f)	MYCONFIG=${OPTARG};;
		*)	echo "ERROR: ${MYNAME} Option ${OPTARG} unknown - early End."
			echo "Only the option -f <filename> is valid."
			exit 1;;
	esac
done

if [ -n "${MYCONFIG}" ] && [ -f "${MYCONFIG}" ]
then
         echo "sourcing ${MYCONFIG}"
         . ${MYCONFIG}
else
        PKGCONF=`dirname $0`/sge_config
        echo "sourcing ${PKGCONF}"
        . ${PKGCONF}
fi

if [ "${SGE_VER}" = "6.0" ]; then
	# Register resource for sge_qmaster
	/usr/cluster/bin/scrgadm -a -j ${QMASTERRS} -g ${MASTERRG} -t ${GDSTYPE} \
-x Start_command="/opt/SUNWscsge/bin/sge_qmaster6/start_sge_qmaster \
-R ${QMASTERRS} -G ${MASTERRG} -S ${SGE_ROOT} -C ${SGE_CELL}" \
-x Stop_command="/opt/SUNWscsge/bin/sge_qmaster6/stop_sge_qmaster \
-R ${QMASTERRS} -G ${MASTERRG} -S ${SGE_ROOT} -C ${SGE_CELL}" \
-x Probe_command="/opt/SUNWscsge/bin/sge_qmaster6/probe_sge_qmaster \
-R ${QMASTERRS} -G ${MASTERRG} -S ${SGE_ROOT} -C ${SGE_CELL}" \
-y Port_list=${MASTERPORT}/tcp -y Network_resources_used=${MASTERLH} \
-x Stop_signal=9 \
-x probe_timeout=90 -y Thorough_probe_interval=120 \
-y retry_count=2 -y retry_interval=900 \
-y Resource_dependencies=${MASTERHASP}
	St=$?
	if [ "${St}" -ne 0 ]; then
		echo "Error: Registration of resource ${QMASTERRS} failed."
		echo "Please correct the wrong parameters."
		exit 1
	else
		echo "Registration of resource ${QMASTERRS} succeeded"
	fi

	# Register resource for sge_schedd
	/usr/cluster/bin/scrgadm -a -j ${SCHEDDRS} -g ${MASTERRG} -t ${GDSTYPE} \
-x Start_command="/opt/SUNWscsge/bin/sge_schedd6/start_sge_schedd \
-R ${SCHEDDRS} -G ${MASTERRG} -S ${SGE_ROOT} -C ${SGE_CELL}" \
-x Stop_command="/opt/SUNWscsge/bin/sge_schedd6/stop_sge_schedd \
-R ${SCHEDDRS} -G ${MASTERRG} -S ${SGE_ROOT} -C ${SGE_CELL}" \
-x Probe_command="/opt/SUNWscsge/bin/sge_schedd6/probe_sge_schedd \
-R ${SCHEDDRS} -G ${MASTERRG} -S ${SGE_ROOT} -C ${SGE_CELL}" \
-y Port_list=${MASTERPORT}/tcp -y Network_resources_used=${MASTERLH} \
-x Stop_signal=9 \
-x probe_timeout=90 -y Thorough_probe_interval=120 \
-y retry_count=2 -y retry_interval=900 \
-y Resource_dependencies=${QMASTERRS}
	St=$?
	if [ "${St}" -ne 0 ]; then
		echo "Error: Registration of resource ${SCHEDDRS} failed."
		echo "Please correct the wrong parameters and try again."
		echo "Removing resource ${QMASTERRS}."
		/usr/cluster/bin/scrgadm -r -j ${QMASTERRS}
		exit 1
	else
		echo "Registration of resource ${SCHEDDRS} succeeded"
	fi
else
	echo "Fatal: Please set variable SGE_VER properly in `dirname $0`/sge_config!"
	exit 1
fi

Listing of sge_remove

#!/bin/ksh
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident	"@(#)sge_remove.ksh	1.3	06/04/24 SMI"
#

MYCONFIG=""
MYNAME=`basename $0`

typeset opt

while getopts 'f:' opt
do
	case "${opt}" in
		f)	MYCONFIG=${OPTARG};;
		*)	echo "ERROR: ${MYNAME} Option ${OPTARG} unknown - early End."
			echo "Only the option -f <filename> is valid."
			exit 1;;
	esac
done

if [ -n "${MYCONFIG}" ] && [ -f "${MYCONFIG}" ]
then
	echo "sourcing ${MYCONFIG}"
	. ${MYCONFIG}
else
	PKGCONF=`dirname $0`/sge_config
	echo "sourcing ${PKGCONF}"
	. ${PKGCONF}
fi

/usr/cluster/bin/scswitch -n -j ${SCHEDDRS}
/usr/cluster/bin/scswitch -n -j ${QMASTERRS}

/usr/cluster/bin/scrgadm -r -j ${SCHEDDRS}
/usr/cluster/bin/scrgadm -r -j ${QMASTERRS}