Hitachi

uCosminexus Application Server Operation, Monitoring, and Linkage Guide


2.6.5 Settings for automatic stop

In UNIX, Management Server and Administration Agent can be stopped automatically when the host stops.

Organization of this subsection

(1) Settings for automatically stopping Management Server

The procedures for specifying the settings for automatically stopping Management Server are described here for each OS.

Important note

If you specify settings to automatically restart Management Server, Management Server cannot be stopped by these procedures. Stop the host after stopping each logical server. However, in Red Hat Enterprise Linux Server 7 or later, even if the settings are specified so that the Management Server automatically restarts, you can use these procedures to stop the Management Server.

(a) Stopping procedures for AIX

The following actions are required to make Management Server stop automatically when the host stops:

  1. Create a script file to make Management Server stop.

  2. Add the processing to make Management Server stop in the /etc/rc.shutdown script.

The following are the methods to create a script file for stopping Management Server, and the methods of adding the stop processing of Management Server to the /etc/rc.shutdown script:

Creating a script file to make Management Server stop

Create a script file for making Management Server stop with any file name under /etc/ (example: /etc/MngSvrStop). Furthermore, set up the authority of the script file to 755.

The following is an example of a script file:

#!/bin/sh
BIN_PATH=/opt/Cosminexus/manager/bin
# Stopping Management Server
if [ -x $BIN_PATH/mngsvrctl ] ; then
  $BIN_PATH/mngsvrctl stop
fi
exit 0

In this example, even if the stop processing fails, the shutdown processing is not interrupted because of the last exit 0. If the shutdown is interrupted when an error occurs, check the return codes after the execution of respective commands and return a return code other than 0.

Note that to stop a logical server when the host stops, add the script that stops the logical server above the script that stops the Management Server.

The following is an example of a script file:

#!/bin/sh
BIN_PATH=/opt/Cosminexus/manager/bin
#Stopping logical server
if [ -x $BIN_PATH/mngsvrutil ] ; then
  $BIN_PATH/mngsvrutil -m mnghost:28080 -u user1 -p user1 -t mnghost -k host -s stop server
fi
# Stopping Management Server
if [ -x $BIN_PATH/mngsvrctl ] ; then
  $BIN_PATH/mngsvrctl stop
fi
exit 0

Specify the various options of the mngsvrutil command in accordance with the operating environment.

Adding the stop processing of Management Server to the /etc/rc.shutdown script

Add the script file that stops Management Server in the /etc/rc.shutdown script as the processing executed using the /etc/rc.shutdown script. When stopping Management Server and Administration Agent on the same host, set up the order so that Management Server stops before Administration Agent stops.

The following is an example of adding the stop processing of Management Server to the /etc/rc.shutdown script. Note that this is an example when the script file that stops Management Server is saved in /etc/MngSvrStop.

if [ -x /etc/MngSvrStop ]; then
  /etc/MngSvrStop
fi

(b) Stopping procedures in Linux

The procedures to specify the settings for Management Server to stop automatically when the host stops are described here. Also, the procedures for specifying the settings for a logical server to stop automatically when the host stops are described.

Procedures for specifying the settings that stop Management Server automatically when the host stops

If automatic start of Management Server is enabled (by using the mngautorun command), automatic stop is also enabled.

If the -sync option is specified in the mngautorun command, the timeout value for automatic stop of Management Server is set to 120 seconds by default. If you want to change the timeout value (by using the -timeout option) for automatic stop of Management Server, use the following procedure:

  1. In the /etc/systemd/system directory, open the CoMS.service file, and then add the timeout value specification to the ExecStop= option.

    The following shows an example of adding the timeout value specification.

    Example:

    Before changing the CoMS.service file:

    ExecStop= /opt/Cosminexus/manager/bin/mngsvrctl stop -sync

    After changing the CoMS.service file:

    ExecStop= /opt/Cosminexus/manager/bin/mngsvrctl stop -sync -timeout 120

    Note: The portion that is in bold type and has a background color has been added. You can change the italicized value according to the operating environment.

  2. Execute the following command to apply the change made to the CoMS.service file in step 1:

    # systemctl reenable CoMS.service
    Important note

    The settings specified in the CoMS.service file in this procedure are reset when the mngautorun command is executed again. To change the settings again, perform the procedure again.

If you want both Administration Agent and Management Server to stop on the same host, enable automatic start for both components (by specifying the both option in the mngautorun command). In this case, if you set synchronous start (by specifying the -sync option in the mngautorun command), Management Server stops and then Administration Agent stops when the host stops or restarts.

Procedures for specifying the settings that stop a logical server automatically when the host stops

The following is the procedure for specifying the settings for a logical server to stop automatically when the host stops. Note that in this procedure, it is a prerequisite that the management domain is configured only on the host on which Management Server is stopped.

  1. In the /etc/systemd/system directory, open the CoMS.service file with a text editor, and then copy and record the command that is set for the ExecStop= option.

  2. Create a script file that stops the logical server and Management Server. You can create this file in any location and with any name of your choice (in this example, create the /opt/Cosminexus/manager/bin/LS_MNG_stop file). The following is an example to create a script file:

    #!/bin/sh
     
    ret=0
     
    /opt/Cosminexus/manager/bin/mngsvrutil -m mnghost:28080 -u user1 -p user1 -t mnghost -k host -s stop server
    ERROR=$?
    if [ $ERROR -ne 0 ] ; then
        ret=1
    fi
     
    /opt/Cosminexus/manager/bin/mngsvrctl stop -sync
    ERROR=$?
    if [ $ERROR -ne 0 ] ; then
        ret=1
    fi
     
    exit $ret

    For the mngsvrutil command, specify the appropriate options according to the operating environment. Note that the command statement you recorded in step 1 is specified in this file to stop Management Server.

  3. Change the access permission settings for the created script file:

    # chmod 755 /opt/Cosminexus/manager/bin/LS_MNG_stop
  4. In the /etc/systemd/system directory, open the CoMS.service file with a text editor again, and then change the path in the ExecStop= option to the path of the script file you created in step 2.

    The following shows an example of changing the settings in the CoMS.service file.

    Before the change (in the case of mngautorun with -sync specified):

    ExecStop=/opt/Cosminexus/manager/bin/mngsvrctl stop -sync

    After the change (in the case of the script created in step 2):

    ExecStop=/opt/Cosminexus/manager/bin/LS_MNG_stop
  5. If asynchronous start is set (mngautorun with both specified and -sync omitted) for Administration Agent and Management Server, add CoAA.service to the After= option in the CoMS.service file.

    The following shows an example of changing the settings in the CoMS.service file.

    Before changing CoMS.service (in the case of mngautorun with -sync omitted):

    After=network.target multi-user.target

    After the change:

    After=CoAA.service network.target multi-user.target
  6. Execute the following command to apply the changes to the CoMS.service file:

    # systemctl reenable CoMS.service
    Important note

    The settings specified in the CoMS.service file in this procedure are reset when the mngautorun command is executed again. To change the settings again, perform the procedure again.

Procedure for removing the settings that stop the logical server automatically when the host stops:

After you have specified the settings that stop the logical server automatically when the host stops, if you want to remove the settings, use the following procedure:

  1. In the procedure shown earlier, you created /opt/Cosminexus/manager/bin/LS_MNG_stop, a script file that stops the logical server and Management Server. In this step, open this file with a text editor, and then copy and record the Management Server stop command.

  2. In the /etc/systemd/system directory, open the CoMS.service file, and then change the command in the ExecStop= option to the command you recorded in step 1.

    The following shows an example of changing the settings in the CoMS.service file.

    Before the change:

    ExecStop=/opt/Cosminexus/manager/bin/LS_MNG_stop

    After the change:

    ExecStop=/opt/Cosminexus/manager/bin/mngsvrctl stop -sync
  3. If asynchronous start is set (mngautorun with both specified and -sync omitted) for Administration Agent and Management Server, delete CoAA.service from the After= option in the CoMS.service file.

    The following shows an example of changing the settings in the CoMS.service file.

    Before the change:

    After=CoAA.service network.target multi-user.target

    After the change:

    After=network.target multi-user.target
  4. Execute the following command to apply the changes to the CoMS.service file:

    # systemctl reenable CoMS.service
  5. Delete the script file that stops the logical server and Management Server (/opt/Cosminexus/manager/bin/LS_MNG_stop in this example).

(2) Settings for automatically stopping Administration Agent

The procedure for specifying the settings for automatically stopping Administration Agent are described here for each OS.

Important note

If you specify settings to automatically restart Administration Agent, Administration Agent cannot be stopped by these procedures. Stop the host after stopping each logical server. However, in Red Hat Enterprise Linux Server 7 or later, even if the settings are specified so that the Administration Agent automatically restarts, you can use these procedures to stop the Administration Agent.

(a) Stopping procedures for AIX

The following actions are required for Administration Agent to stop automatically when the host stops:

  1. Create a script file for Administration Agent to stop.

  2. Add a processing for Administration Agent to stop in the /etc/rc.shutdown script.

The following are the procedures to create a script file for Administration Agent to stop, and the procedures of adding the stop processing of Administration Agent to the /etc/rc.shutdown script:

Creating a script file for Administration Agent stop

Create the script file that stops Administration Agent with any file name under /etc/ (example: /etc/AdminAgentStop). Furthermore, set the authority of the script file to 755.

The following is an example of a script file:

#!/bin/sh
BIN_PATH=/opt/Cosminexus/manager/bin
# Stopping Administration Agent
if [ -x $BIN_PATH/adminagentctl ] ; then
  $BIN_PATH/adminagentctl stop
fi
exit 0

In this example, even if the stop processing fails, the shutdown processing is not interrupted because of the last exit 0. If the shutdown is interrupted when an error occurs, check the return codes after the execution of respective commands and return a return code other than 0.

Adding the stop processing for Administration Agent to the /etc/rc.shutdown script

Add the script file that makes Administration Agent to stop in the /etc/rc.shutdown script as the processing executed using the /etc/rc.shutdown script.

The following is an example of adding the stop processing of Administration Agent to the /etc/rc.shutdown script. Note that this is an example when the script file for Administration Agent to stop is saved in /etc/AdminAgentStop.

if [ -x /etc/AdminAgentStop ]; then
  /etc/AdminAgentStop
fi

(b) Stopping procedures of Linux

If automatic start of Administration Agent is enabled (by using the mngautorun command), automatic stop is also enabled.

If the -sync option is specified in the mngautorun command, the timeout value for automatic stop of Administration Agent is set to 120 seconds by default. If you want to change the timeout value (by using the -timeout option) for automatic stop of Administration Agent, use the following procedure:

  1. In the /etc/systemd/system directory, open the CoAA.service file, and then add the timeout value specification to the ExecStop= option.

    The following shows an example of adding the timeout value specification.

    Example:

    Before changing the CoAA.service file:

    ExecStop=/opt/Cosminexus/manager/bin/adminagentctl stop -sync

    After changing the CoAA.service file:

    ExecStop=/opt/Cosminexus/manager/bin/adminagentctl stop -sync -timeout 120

    Note: The portion that is in bold type and has a background color has been added. You can change the italicized value according to the operating environment.

  2. Execute the following command to apply the change made to the CoAA.service file in step 1:

    # systemctl reenable CoAA.service
    Important note

    The settings specified in the CoAA.service file in this procedure are reset when the mngautorun command is executed again. To change the settings again, perform the procedure again.

    If you want both Administration Agent and Management Server to stop on the same host, enable automatic start for both components (by specifying the both option in the mngautorun command). In this case, if you set synchronous start (by specifying the -sync option in the mngautorun command), Management Server stops and then Administration Agent stops when the host stops or restarts.