Hitachi

JP1 Version 12 JP1/Automatic Operation Configuration Guide 


2.9 Settings for automatically starting JP1/AO when the OS starts (in Linux)

If the OS of the JP1/AO server is Linux, with the initial settings, the JP1/AO service is not automatically started when the OS starts. For the JP1/AO service to start automatically when the OS starts, in the startup script of the OS, specify the value that is set in the LANG environment variable and specify a setting that executes the hcmds64srv command.

Because the services of the common component are set to start automatically at OS startup, you must specify "AutomationWebService" as the server option so that only the JP1/AO service will be started.

When only the JP1/AO service is started with the server option specified, it is necessary to start the common component and database services beforehand. Therefore, it is necessary to check to see whether the JP1/AO service is started after checking the existence of common component and database process.

When the OS is stopped, the JP1/AO service and the services of the common component are set to automatically stop, so you do not need to set automatic stop.

Example:

#!/bin/sh
# chkconfig: 2345 99 01
# description: JP1/Automatic Operation
PROG_NAME=startao

start() {
      /home/jp1ao/startao2 &
}

case "$1" in
  start)
    start
    ;;
  *)
    echo "Usage: ${PROG_NAME} start"
    exit 1
esac
exit 0

/home/jp1ao/startao2

#!/bin/sh
HCMDS_HOME=/opt/HiCommand/Base64

start() {
      export LANG=ja_JP.utf8
      ${HCMDS_HOME}/bin/hcmds64srv -start -server AutomationWebService
      rtn_code=$?
      logger -i -s -t [AUTOMATION] \
      "${HCMDS_HOME}/bin/hcmds64srv -start -server AutomationWebService[${rtn_code}]"
}

for i in `seq 1 10`
do
      cjstartsv_counter=`ps -ef | \
      grep ${HCMDS_HOME}/uCPSB/CC/server/bin/cjstartsv | grep -v grep | wc -l`
      hcs_hsso_counter=`ps -ef | \
      grep \
      ${HCMDS_HOME}/uCPSB/CC/server/repository/HBase64StgMgmtSSOService/hcs_hsso | \
      grep -v grep | wc -l`
      httpsd_counter=`ps -ef | \
      grep ${HCMDS_HOME}/uCPSB/httpsd/sbin/httpsd | grep -v grep | wc -l`
      rotatelogs_counter=`ps -ef | \
      grep ${HCMDS_HOME}/uCPSB/httpsd/sbin/rotatelogs | grep -v grep | wc -l`
      pdprcd_counter=`ps -ef | \
      grep ${HCMDS_HOME}/HDB/lib/servers/pdprcd | grep -v grep | wc -l`
      pdmlgd_counter=`ps -ef | \
      grep ${HCMDS_HOME}/HDB/lib/servers/pdmlgd | grep -v grep | wc -l`
      pdrdmd_counter=`ps -ef | \
      grep ${HCMDS_HOME}/HDB/lib/servers/pdrdmd | grep -v grep | wc -l`
      sleep 60

      if [ $cjstartsv_counter -ge 1 -a \
           $hcs_hsso_counter -ge 1 -a \
           $httpsd_counter -ge 22 -a \
           $rotatelogs_counter -ge 4 -a \
           $pdprcd_counter -ge 1 -a \
           $pdmlgd_counter -ge 1 -a \
           $pdrdmd_counter -ge 1 ]; then
           start
           exit 0
      fi
done

logger -i -s -t [AUTOMATION] "Common Component seems to be dead."
exit 1

This section explains how to use the systemd command to set and cancel automatic startup of the JP1/AO service.

To set automatic startup of the JP1/AO service (Method 1):

  1. Create a Unit file of the automatic startup script for the JP1/AO service.

    Storage location: /etc/systemd/system

    File name: JP1_AO.service

    If the file name is different, replace the part of "JP1_AO.service" in the following description.

    [Unit]
    Description=JP1/AO service
    
    [Service]
    Type=forking
    Environment="LANG=ja_JP.utf8"
    ExecStart=/opt/HiCommand/Base64/bin/hcmds64srv -start -server AutomationWebService
    
    [Install]
    WantedBy=multi-user.target graphical.target
    
  2. Execute the following command to set up the attributes.

    chmod 644 /etc/systemd/system/JP1_AO.service

    chgrp root /etc/systemd/system/JP1_AO.service

    chown root /etc/systemd/system/JP1_AO.service

  3. Execute the following command to enable automatic startup for the JP1/AO service.

    systemctl daemon-reload

    systemctl enable JP1_AO.service

  4. Execute the following command and check that "enabled" is displayed.

    systemctl list-unit-files | grep "UNIT FILE\|JP1_AO.service"

To set automatic startup of the JP1/AO service (Method 2):

Depending on the environment, automatic start may not work well in method 1. It shows the setting procedure in that case.

  1. Create a Unit file for automatic starting of the JP1/AO service.

    Storage location: /etc/systemd/system

    File name: JP1_AO.service

    If the file name is different, replace the part of "JP1_AO.service" in the following description..

    [Unit]
    Description=JP1/AO service
    After=2248-PD01.service hicommand64-hcs_hweb.service hicommand64-hcs_hsso.service hicommand64-hcs_web.service hicommand64-hcs_ao.service
    Requires=2248-PD01.service hicommand64-hcs_hweb.service hicommand64-hcs_hsso.service hicommand64-hcs_web.service hicommand64-hcs_ao.service
    
    [Service]
    Type=forking
    Environment="LANG=ja_JP.utf8"
    ExecStartPre=/home/jp1ao/ao_start_check
    ExecStart=/opt/HiCommand/Base64/bin/hcmds64srv -start -server AutomationWebService
    TimeoutStartSec= 600
    
    [Install]
    WantedBy=multi-user.target graphical.target
    
  2. Execute the following command to set the attributes.

    chmod 644 /etc/systemd/system/JP1_AO.service

    chgrp root /etc/systemd/system/JP1_AO.service

    chown root /etc/systemd/system/JP1_AO.service

  3. Create a script file specified in the ExecStartPre option.

    /home/jp1ao/ao_start_check

    #!/bin/sh
    HCMDS_HOME=/opt/HiCommand/Base64
    
    for i in `seq 1 10`
    do
        cjstartsv_counter=`ps -ef | \
        grep ${HCMDS_HOME}/uCPSB/CC/server/bin/cjstartsv | grep -v grep | wc -l`
        hcs_hsso_counter=`ps -ef | \
        grep \
        ${HCMDS_HOME}/uCPSB/CC/server/repository/HBase64StgMgmtSSOService/hcs_hsso | \
        grep -v grep | wc -l`
        httpsd_counter=`ps -ef | \
        grep ${HCMDS_HOME}/uCPSB/httpsd/sbin/httpsd | grep -v grep | wc -l`
        rotatelogs_counter=`ps -ef | \
        grep ${HCMDS_HOME}/uCPSB/httpsd/sbin/rotatelogs | grep -v grep | wc -l`
        pdprcd_counter=`ps -ef | \
        grep ${HCMDS_HOME}/HDB/lib/servers/pdprcd | grep -v grep | wc -l`
        pdmlgd_counter=`ps -ef | \
        grep ${HCMDS_HOME}/HDB/lib/servers/pdmlgd | grep -v grep | wc -l`
        pdrdmd_counter=`ps -ef | \
        grep ${HCMDS_HOME}/HDB/lib/servers/pdrdmd | grep -v grep | wc -l`
        sleep 60
    
        if [ $cjstartsv_counter -ge 1 -a \
             $hcs_hsso_counter -ge 1 -a \
             $httpsd_counter -ge 22 -a \
             $rotatelogs_counter -ge 4 -a \
             $pdprcd_counter -ge 1 -a \
             $pdmlgd_counter -ge 1 -a \
             $pdrdmd_counter -ge 1 ]; then
             exit 0
        fi
    done
    
    exit 1
    
  4. Execute the following command to set the attributes.

    chmod 554 /home/jp1ao/ao_start_check

    chgrp root /home/jp1ao/ao_start_check

    chown root /home/jp1ao/ao_start_check

  5. Execute the following command to enable automatic startup of the JP1/AO service.

    systemctl daemon-reload

    systemctl enable JP1_AO.service

  6. Execute the following command and confirm that "enabled" is displayed.

    systemctl list-unit-files | grep "UNIT FILE\|JP1_AO.service"

To cancel automatic startup of the JP1/AO service:

Note

If you want to uninstall JP1/AO, cancel the settings specified for the JP1/AO service automatic startup beforehand, and then uninstall the program.

  1. If JP1/AO is running, execute the following command to stop JP1/AO.

    /opt/HiCommand/Base64/bin/hcmds64srv -stop

  2. Execute the following command to disable automatic startup for the JP1/AO service.

    systemctl disable JP1_AO.service

  3. Execute the following command and check that "disabled" is displayed.

    systemctl list-unit-files | grep "UNIT FILE\|JP1_AO.service"

  4. Execute the following command to delete the Unit file for the JP1/AO service.

    rm -i /etc/systemd/system/JP1_AO.service

  5. Execute the following command to delete the script file (method 2).

    rm -i /home/jp1ao/ao_start_check