#!/usr/bin/ksh
if [ `echo $0 | grep -c "/"` -gt 0 ];then
cd ${0%/*}
fi
VCSHOME="${VCS_HOME:-/opt/VRTSvcs}"
. $VCSHOME/bin/ag_i18n_inc.sh
#check whether config.def file exist
if [ ! -f "config.def" ]
then
writeLog "ERROR" "start" "the config.def file isn't exist,exit monitor application."
return 1
else
#source the config file
. ./config.def
fi
#start jboss process
writeLog "INFO" "start" "begin to start jboss..."
su - ${RUN_USER} -c "cd jboss/bin;./start.sh"
typeset USER_HOME=$(cat /etc/passwd|grep -w ${RUN_USER}|awk -F: '{print $6}')
typeset idx=0
typeset expire_times=`expr ${EXPIRED_TIME} / 3 + 1`
while [ ${idx} -lt ${expire_times} ]
do
((idx=idx+1))
grep -x "\* Business container is started successfully! \*" "${USER_HOME}/jboss/bin/run.log" 1>/dev/null 2>&1
if [ $? -eq 0 ]
then
writeLog "INFO" "start" "Starting business container successfully."
writeLog "INFO" "start" "start jboss complete."
#start monitor process
writeLog "INFO" "start" "begin to start monitor..."
su - ${RUN_USER} -c "cd monitor;./start.sh"
writeLog "INFO" "start" "start monitor complete."
break
fi
if [ `expr ${idx} % 20 ` -eq 0 ]
then
VCSAG_LOG_MSG "I" "The start process of ccengine is running." 30000
fi
sleep 3
done
#Notice VCS to wait 10 seconds before next monitor execute
return 10