The execute permission for each script is user: root and group: root.
Environment variables set in each server ("/etc/profile" or "etc/bashrc", for example) are not guaranteed to be inherited by Start, Stop, and Check scripts. Therefore, make sure to define the environment variables used with these scripts in each script.
The Check script is called in regular intervals (10-second intervals) after starting RMS. It does not synchronize with the Start or Stop script.
Therefore, at the time the Check script is started, the processing of the Start script has not completed or the Stop script may still be in process.
If the Check script has started before completing the Start script, create a script so that the exit code Offline is returned.
When multiple Cmdlines are registered in userApplication, it is performed in the order of registering Cmdline when starting userApplication. On the other hand, when stopping it, it is performed in the opposite order of registering Cmdline. The example is as follows.
The resource registered first is Command[0], the resource registered next is Command[1].
Those resources are started and stopped in the following order.
StartCommands[0] StartCommands[1]
StopCommands[1] StopCommands[0]
To register each script, make sure to check the script operation.
If the created script does not operate properly, the startup of userApplication or a switchover may fail.
The Cmdline resource is managed by its creator. Thus, for the operation error, the creator need to investigate the cause, modify the error, and check the operation.
To investigate the cause of the error immediately, take some actions such as outputting a log.
The Stop script is also executed when a resource failure occurs.
The Cmdline resource starts the Start and Stop scripts so that the standard output and standard error output is stored in the following log.
/var/opt/SMAWRrms/log/"user_application_name".log
"user application name" is the user application name that the Cmdline resource has registered. If the Start or Stop script does not operate properly, you can investigate the cause from the message output in this file.
When starting a resident process from the Start script registered in the Cmdline resource, a file descriptor of the Start script is transferred to the resident process. To output a message to a standard error or standard error output from the resident process, the message is stored in the "user application name".log file. However, the purpose of this file is to obtain a message that the Start and Stop scripts of a resource output. The messages output from the resident process all the time are not assumed. If the resident process keeps outputting messages, the "user application name".log file may weigh on its disk space.
To start operational application which has a resident process from the Cmdline resource, perform any one of the following resolutions:
Change the setting of the operational application so that the resident process does not output a message to a standard output or standard error output.
Immediately after starting the resident process, modify the processing of the resident process so that the file descriptor of the standard output or standard error output transferred from the Start script becomes CLOSE.
Point
The resident process is started with taking over file descriptors other than the standard output or standard error output. There is no problem to close all the file descriptors.
Redirect the messages output from the resident process within the Start script to /dev/null or other files.
Example
If a resident process is started with the Start command; StartCommand.sh, register the Start command as follows:
The messages output are unnecessary for the operation (the messages are discarded with /dev/null file).
/usr/local/bin/StartCommand.sh > /dev/null 2>&1
The messages are necessary for the operation and they are output to the log file /var/tmp/logfile.
/usr/local/bin/StartCommand.sh > /var/tmp/logfile 2>&1
Note
To redirect the messages output from the resident process to other log files, you need to delete log files periodically so that they do not weigh on their disk space. You cannot delete log files during the resident process operation, copy /dev/null to log files so that the size of them becomes 0.
cp /dev/null /var/tmp/logfile
Setting the size of log files 0 periodically from the cron command allows the operation with the enough disk space.