#!/usr/bin/ksh

# Set path to known value
PATH=/usr/sbin/rsct/bin:/usr/bin:/usr/sbin:/bin
export PATH
RMCRESTART='/tmp/ctinst.restart_ctrmc'
RMCSUBSYS='ctrmc'
ParsePid="s/^ *[^ ]* *[^ ]* *\([0-9]*\) *active/\1/p"

# if not NIM or BOS install
if [[ -z "$INUCLIENTS" && -z "$INUBOSTYPE" ]]
then
	Proc=$(LC_ALL=C lssrc -s ${RMCSUBSYS} 2> /dev/null | grep "active" | \
				sed -n -e "$ParsePid" | tr '\n' ',')

	#touch ctinstall marker file to ensure ctrmc is restarted in posti
	if [[ -n "${Proc}" ]]
	then
		/bin/touch -f $RMCRESTART > /dev/null 2>&1
	fi	
fi

# invoke the ct install utility

/usr/sbin/rsct/install/bin/ctinstall -t R -f rsct.core.utils -g RSCT_ALL
rc=$?

exit 0

