Hitachi

uCosminexus Application Server Operation, Monitoring, and Linkage Guide


17.6.5 Creating a shell script file

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:

Use the same shell script file in Application Server of the active node and Application Server of the spare node, and deploy in the same path.

Organization of this subsection

(1) Shell script file for monitoring the processes of the Administration Agent

An example of the shell script file for monitoring the processes of the Administration Agent (manager_adminagent_monitor.sh) is 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

(2) Shell script file for starting the Administration Agent and logical servers

An example of the shell script file for starting the Administration Agent and logical servers (manager_adminagent_start.sh) is as follows:

#!/bin/sh
 
LOGDIR=/home/manager/hamon/log
SCRIPTDIR=/home/manager/hamon/bin
MNGDIR=/opt/Cosminexus/manager
 
logg()
{
  echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \
    >> ${LOGDIR}/adminagent.log 2>&1
}
 
# make adminagent.access.info
logg "### $0: make adminagent.access.info ###"
echo 172.16.12.30:28080,hostA:20295 > $MNGDIR/tmp/adminagent.access.info
 
# 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
 
sleep 10
 
# start logical server
logg "### $0: starting logical servers. ###"
$MNGDIR/bin/mngsvrutil -m mnghost:28080 -t lserver1 -s start server
$MNGDIR/bin/mngsvrutil -m mnghost:28080 -t lserver2 -s start server
$MNGDIR/bin/mngsvrutil -m mnghost:28080 -t lserver3 -s start server
 
exit 0

Use the shell script file to create the access information file (/opt/Cosminexus/manager/tmp/adminagent.access.info)#, and to start the Administration Agent and logical servers.

#

The access information file is deleted after starting the Administration Agent and is restarted when accessing the file from Management Server.

Here, specify the settings in such a way so that the contents are the same as those re-created when you access the access information file from Management Server. Based on this file, each logical server is restarted when node switching occurs due to failure of a node.

The settings to be specified in the shell script file are as follows:

Creating the access information file
Coding corresponding to the shell script file in the example
echo 172.16.12.30:28080,hostA:20295
              > $MNGDIR/tmp/adminagent.access.info
Format
<Mng_ip>:<Mng_port>,<AA_host>:<AA_port>

The contents to be specified are as follows:

  • Mng_ip

    Specifies the IP address of the host in which Management Server exists.

  • Mng_port

    Specifies the HTTP port number for connecting to Management Server.

  • AA_host

    Specifies the host name of the Administration Agent. Specify the value specified in the host in 'Configuration definition of management domain' of the management portal of Management Server.

  • AA_port

    Specifies the port number of the Administration Agent. Specify the value specified in the port number of the Administration Agent in 'Configuration definition of management domain' of the management portal of Management Server.

Starting the logical servers

Specify the settings for starting the logical servers.

Use the mngsvrutil command to start the logical servers. For the mngsvrutil command, see mngsvrutil (Management Server management command) in the uCosminexus Application Server Command Reference Guide.

(3) Shell script file for stopping the Administration Agent and logical servers

An example of the shell script file for stopping the Administration Agent and logical servers (manager_adminagent_stop.sh) is 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 -t lserver3 -s stop server
$MNGDIR/bin/mngsvrutil -m mnghost:28080 -t lserver2 -s stop server
$MNGDIR/bin/mngsvrutil -m mnghost:28080 -t lserver1 -s stop server
 
# stop Administration Agent
logg "### $0: stopping Administration Agent. ###"
$MNGDIR/bin/adminagentctl stop