25.7.4 Shell script for generating a dummy process (services monitored by MC/ServiceGuard) (monitor mode only)

MC/ServiceGuard monitors services (applications). It executes a service as a sub-process, and when it detects service termination, it determines that a package error has occurred. The only interface between HiRDB and MC/ServiceGuard, except for HiRDB startup and termination processing, is service termination (exit). All HiRDB processes are monitored by pdprcd and are restarted by HiRDB facilities after an abnormal termination. Therefore, there is no need to have MC/ServiceGuard monitor HiRDB processes. Figure 25-48 shows the relationship between process startup and monitoring.

Figure 25-48 Relationship between process startup and monitoring (MC/ServiceGuard)

[Figure]

To maintain the status in which HiRDB is running as a package, a dummy service (dummy process) is necessary. This dummy process must satisfy all the following conditions:

Conditions
  1. The process must be resident.
  2. Because MC/ServiceGuard issues SIGTERM when it issues an instruction to terminate the package, the process must be terminated when SIGTERM is received.
  3. There is no need to notify MC/ServiceGuard of HiRDB abnormal termination.

The following is an example of a shell script for generating a dummy process:

#!/bin/sh
trap exit SIGTERM
while true
do
   sleep 5
done
exit

Explanation
This example is coded in the Bourne shell. sleep is executed in an infinite loop until SIGTERM (=15) is received. Other implementation methods are also possible.

Specify this shell script in SERVICE_CMD in the package control script. To start a resident process, infinite startup should be used by specifying SERVICE RESTART ="-R" in the package control script. Otherwise, unexpected termination will be treated as abnormal termination of the HiRDB server.