#!/bin/ksh93
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r720 src/43haes/usr/sbin/cluster/sa/tsmserver/sbin/cl_tsmserverstart.sh 1.2 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2010 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)25	1.2  src/43haes/usr/sbin/cluster/sa/tsmserver/sbin/cl_tsmserverstart.sh, hacmp.assist, 61haes_r720, 1539B_hacmp720 9/11/15 17:15:03
###############################################################################################
#
# NAME:
#       cl_tsmserverstart
#
# PURPOSE:
#       sart script of Smart Assist for TSM server instance 
#
# ARGUMENTS:
#       -i TSM instance name
#       -d TSM instance directory
#
# RETURNS
#  0 on success
#  1 on Failure
#
#################################################################################################

[[ VERBOSE_LOGGING == "high" ]] && set -x
. /usr/es/sbin/cluster/sa/tsmserver/sbin/cl_tsmserverGlobals
KLIB_HACMPLOG_ENTRY=$KLIB_TSM_SERVER_HACMPLOG_ENTRY

typeset inst_name inst_dir

while getopts i:d: opt
do
	case $opt in
		
		i) # instance name, which will be highly available
			inst_name=$OPTARG
			;;	

		d) # instance directory
			inst_dir=$OPTARG
			;; 
	esac
done
dat=$(/usr/bin/date)
KLIB_SA_logmsg INFO 2 1 tsmserversa.cat "\n starting the TSM server instance %1\$s with instance directory %2\$s at %3\$s\n" $inst_name $inst_dir "$dat"
#starting DB2 before TSM server instance, so we can avoid of having host name same across all nodes
/usr/bin/su $inst_name -c ". ~$inst_name/.profile && db2gcf -u -p 0" >/dev/null 2>&1
stat=$?
(( $stat == 0 )) || {
                     exit $stat
    }
$TSM_SERVER_BIN/rc.dsmserv -u $inst_name -i $inst_dir quiet & >/dev/null 2>&1
exit $?

