uCosminexus Application Server, Operation, Monitoring, and Linkage Guide

[Contents][Glossary][Index][Back][Next]

18.5.5 Creating the shell script file

Create the following shell script files to monitor the Administration Agent process and to start and stop the logical servers:

Note that when you have specified the settings for switching the nodes when the operating status of the logical servers is 'abnormal termination' (when the system has exceeded the automatic restart frequency or when the system detects a failure at automatic restart frequency 0), add the monitoring process of Management Server in the shell script file.

Organization of this subsection
(1) Shell script file for monitoring the Administration Agent process
(2) Shell script file for starting the logical server
(3) Shell script file for stopping the logical server

(1) Shell script file for monitoring the Administration Agent process

An example of the shell script file for monitoring the Administration Agent process (manager_adminagent_monitor.sh) is as follows:

 
#!/bin/sh
 
LOGDIR=/home/manager/hamon/log
AA=/opt/Cosminexus/manager/bin/adminagent
MNGDIR=/opt/Cosminexus/manager
 
logg ()
{
  echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \
    >> ${LOGDIR}/adminagent.log 2>&1
}
 
logg "### $0: started. ###"
while true
do
  $MNGDIR/bin/mngsvrutil -m 192.168.0.1-to-1 :28080 -t 192.168.1-to-1 1-to-1 check adminAgent
  if [ $? -ne 0 ]
  then
    logg "### $0: stop. ###"
    exit 0
  fi
  sleep 10
done
 

In this shell script file, you check the operational status of the Administration Agent using the check command of mngsvrutil. Specify the stationary IP address of the host in the argument host name of the -m option and the alias IP address of the virtual host of the active node in the argument of the -t option of the mngsvrutil command.

Note that this shell script file describes the monitoring of the Administration Agent that runs on the active node 1 (spare node 2) of the Node 1. For using the shell script file in the spare node 1 (active node 2) of Node 2, replace the argument host name of the -m option with the stationary IP address (192.168.0.22) of Node 2 and the argument in the -t option with the alias IP address (192.168.2.222) of the virtual host of the active node.

(2) Shell script file for starting the logical server

An example of the shell script file for starting the logical server (manager_apserver1_start.sh) is as follows:

 
#!/bin/sh
 
MNGDIR=/opt/Cosminexus/manager
logg ()
{
  echo `date '+[%Y/%m/%d %H:%M:%S]'`"[$$]: $1" \
    >> ${LOGDIR}/adminagent.log 2>&1
}
# start logical server
logg "### $0: starting logical servers. ###"
$MNGDIR/bin/mngsvrutil -m 192.168.0.1-to-1 :28080 -t performance-tracer -s start server
$MNGDIR/bin/mngsvrutil -m 192.168.0.1-to-1 :28080 -t J2EE-server-1 -s start server
$MNGDIR/bin/mngsvrutil -m 192.168.0.1-to-1 :28080 -t Web-server-1 -s start server
exit 0
 

In this shell script file, you start the logical server. Specify the stationary IP address of the host in the argument host name of the -m option and the name of the logical server to be started in the argument of the -t option of the mngsvrutil command.

Note that this shell script file describes the starting of the logical server in the active node 1 of Node 1.

(3) Shell script file for stopping the logical server

An example of the shell script file for stopping the logical server (manager_apserver1_stop.sh) is as follows:

 
#!/bin/sh
 
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 192.168.0.1-to-1 :28080 -t Web-server-1 -s stop server graceful:300
$MNGDIR/bin/mngsvrutil -m 192.168.0.1-to-1 :28080 -t J2EE-server-1 -s stop server
$MNGDIR/bin/mngsvrutil -m 192.168.0.1-to-1 :28080 -t performance-tracer -s stop server
 

In this shell script file, you stop the logical server. Specify the stationary IP address of the host in the argument host name of the -m option and the name of the logical server to be stopped in the argument of the -t option of the mngsvrutil command.

Note that this shell script file illustrates the stopping of the logical server in the active node 1 of Node 1.