uCosminexus Application Server, Operation, Monitoring, and Linkage Guide
Create the following shell script files to monitor the processes of the Administration Agent and to start and stop the Administration Agent and logical servers:
Each script is described as follows:
An example of the shell script file for monitoring the processes of the Administration Agent (monitor.sh) is described as follows:
#!/bin/sh LOGDIR=/home/manager/hamon/log AA=/opt/Cosminexus/manager/bin/adminagent logg() { echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \ >> ${LOGDIR}/adminagent.log 2>&1 } logg "### $0: started. ###" while true do CHECK=`ps -ef | grep $AA | grep -v grep` if [ "$CHECK" = "" ] then logg "### $0: stop. ###" exit 0 fi sleep 10 done |
In this example, every 10 seconds, the shell script file monitors whether the processes of the Administration Agent exist.
An example of the shell script file for starting the Administration Agent (start.sh) is described as follows:
#!/bin/sh LOGDIR=/home/manager/hamon/log MNGDIR=/opt/Cosminexus/manager logg() { echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \ >> ${LOGDIR}/adminagent.log 2>&1 } # start Administration Agent logg "### $0: starting Administration Agent. ###" $MNGDIR/bin/adminagentctl start if [ $? -eq 0 ] ; then logg "### $0: Administration Agent start normally. ###" else logg "### $0: Administration Agent cannot start. ###" exit 1 fi exit 0 |
An example of the shell script file for stopping the Administration Agent and logical servers (stop.sh) is described as follows:
#!/bin/sh LOGDIR=/home/manager/hamon/log MNGDIR=/opt/Cosminexus/manager logg() { echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \ >> ${LOGDIR}/adminagent.log 2>&1 } # stop logical server logg "### $0: stop logical servers. ###" $MNGDIR/bin/mngsvrutil -m mnghost:28080 -u admin -p admin \ -t 172.16.12.31 -k host -s stop server # stop Administration Agent logg "### $0: stopping Administration Agent. ###" $MNGDIR/bin/adminagentctl stop exit 0 |
The settings to be specified in the shell script file are described as follows. For details on the commands and files, see the manual Cosminexus Application Server Commands, or the manual Cosminexus Application Server Server Definitions.
An example of the shell script file for executing the recovery process for each J2EE server (recover.sh) is described as follows:
#!/bin/sh LOGDIR=/home/manager/hamon/log PATH=/opt/Cosminexus/CC/server/bin:/bin:/usr/bin:/home/manager/hamon/bin LD_LIBRARY_PATH=/opt/DABroker/lib:/opt/Cosminexus/jdk/lib:/opt/Cosminexus/TPB/lib:/opt/Cosminexus/PRF/lib:/opt/Cosminexus/CTM/lib:/bin:/opt/HiRDB/client/lib:/opt/oracle/app/oracle/product/10.1.0/client_1/lib:/opt/oracle/app/oracle/product/10.1.0/client_1/lib/libclntsh.so.10.1:/opt/oracle/app/oracle/product/10.1.0/client_1/lib/libclntsh.so export LD_LIBRARY_PATH LOCKFILE=/var/lock/kosmi_recover.lock SLEEP_TIME=60 RETRIES=30 STATUS_PATH=$3/otsstatus cjlockfile() { counter=$2 TMP_LOCK_FILE=`dirname $3`/$$.lock echo $$ > $TMP_LOCK_FILE if [ -f $3 ] then kill -0 `cat $3` 2>/dev/null || rm -f $3 fi until ln $TMP_LOCK_FILE $3 2>/dev/null do counter=`expr $counter - 1` if [ $counter -le 0 ] then rm -f $TMP_LOCK_FILE return 1 fi sleep $1 done rm -f $TMP_LOCK_FILE return 0 } logg() { echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \ >> ${LOGDIR}/adminagent.log 2>&1 } if cjlockfile ${SLEEP_TIME} ${RETRIES} ${LOCKFILE} then logg "### $0: started for $1 ###" cjstartrecover MyServer -p vbroker.se.iiop_tp.host=$2 \ -p ejbserver.distributedtx.ots.status.directory1=$STATUS_PATH \ -t 600 logg "### $0: ended. $? ###" fi rm -f $LOCKFILE exit 0 |
The settings to be specified in the shell script file are described as follows. For details on the commands and files, see the manual Cosminexus Application Server Commands, or the manual Cosminexus Application Server Server Definitions.
For the cjstartrecover command, see cjstartrecover (Recovering the J2EE server transactions) in the uCosminexus Application Server Command Reference Guide. For the ejbserver.distributedtx.ots.status.directory1 and vbroker.se.iiop_tp.host keys, see 2.4 usrconf.properties (User property file for J2EE servers) in the uCosminexus Application Server Definition Reference Guide.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.