This section describes notes when creating scripts.
Examples of the Start and Stop scripts other than Hot-standby operation are as follows.
The script $FULL_PATH/script.sample is an example when the following operations and settings are assumed.
Start script $FULL_PATH/Script.sample -c
Stop script $FULL_PATH/Script.sample -u
STANDBYCAPABLE: No
AUTORECOVER: No
CLUSTEREXCLUSIVE: Yes
NULLDETECTOR: No
MONITORONLY: No
Below is an example when assuming the operation is the same for standby and operational systems by following "Table 6.3 The Cmdline resource in other than Hot-standby operation." The same processing is executed in the lines where Start script is described. The same processing is also executed in the lines where Stop script is described.
When assuming operations other than the above, refer to the environment variable and attribute to change them.
Moreover, below is an example when assuming that the operation of the following sample $FULL_PATH/Script is corresponding Hot-standby operation.
Start script $FULL_PATH/Script.sample -c
Stop script $FULL_PATH/Script.sample -u
STANDBYCAPABLE: Yes
AUTORECOVER: No
CLUSTEREXCLUSIVE: Yes
ALLEXITCODES: Yes
NULLDETECTOR: No
MONITORONLY: No
Below is an example of the Start script when the status is transited from Offline to Standby and also from Offline to Online. The transitions are distinguished as "Table 6.4 The Cmdline resource in Hot-standby operation."
In addition to that, another example that the Stop script distinguishes when the status is transited from Standby to Offline and also from Online to Offline is as follows.
When assuming operations other than the above, refer to the environment variable and attribute to change them.
When executing the Start script and Stop script, the following environment variables are set. You can refer to those environment variables within the scripts.
Table 3.4 indicates the environment variables set in the scripts.
Environment variables | Outline |
---|---|
This variable sets the userApplication name that the resource belongs to. Example) app1 | |
The value of this variable indicates whether the script is triggered by AutoRecover or not. 0: Not triggered by AutoRecover that is executed with the Online processing | |
This variable sets a value that indicates whether or not forced failover was requested by operator intervention. 0: Forced failover was not requested. | |
This variable sets the resource name. Example) ManageProgram000_Cmd_APP1, RunScriptsAlways000_Cmd_APP1 | |
HV_OFFLINE_REASON | This variable sets the trigger for bringing the resource Offline. SWITCH: The resource was set to Offline because of a userApplication switchover request (hvswitch) |
This variable sets the type of script that was executed. Online: Online script | |
This variable sets the state of the current resources just before execution of the Start/Stop script. Online: Online state | |
This variable sets the resource state that is expected after state transition is completed. Online: Online state | |
This variable sets the timeout duration (seconds) of the script. Example) 300 |
RMS has other environment variables.
See
For details on the RMS environment variables, see "Appendix E Environment variables" in "PRIMECLUSTER Reliant Monitor Services (RMS) with Wizard Tools Configuration and Administration Guide."
The state transition operation of a userApplication varies depending on the exit code of the Start and Stop script: Below indicates the operations of the exit code and the state transition.
The system assumes that the state transition of the Cmdline resource was processed normally, and state transition processing of the userApplication continues. If all the resources of the userApplication are processed normally, the state transition of the
userApplication is also processed normally
The system assumes that an error occurred during the state transition of the Cmdline resources and interrupts state transition processing of the userApplication.
RMS does not monitor the state of the Cmdline resource when the NULLDETECTOR flag is enabled. In this case, Online script may be executed when the resource is already started or Offline script may be executed when the resource is already stopped. To prevent Online or Offline processing to be terminated with error, be sure to add following tasks to Online script and Offline script of the Cmdline resource when the NULLDETECTOR flag is enabled.
Online script
Check whether a target program has already run before starting it within the Online script. If it has already run, the Online script is immediately stopped.
Offline script
Check whether the target program has already stopped before stopping it within the Offline script. If it has already stopped, the Offline script is immediately stopped.
Note
If the userApplication state before the maintenance mode is started is Online, the Online script of Cmdline resource where the NULLDETECTOR flag is set is executed.
If the Start or Stop script processing is not completed within the specified time, a timeout occurs. Then, the script processing is interrupted by the SIGTERM signal and state transition ends with an error.
The timeout value can be specified with the TIMEOUT flag value of the Cmdline resources. The default value is 300 seconds.
When creating the Cmdline resource, you need to calculate the maximum processing time for each script and set a value with enough time. If a timeout occurs when the Cmdline resource is used (any one of the following messages is output: (DET, 5), (DET, 6), or (DET, 24)), change the timeout value to an appropriate value according to each operating system being used.
Select "Application-Edit" from the Main configuration menu to change the Flag of the Cmdline resource.
For details, see "10.3 Changing a Cluster Application."
Note
The processing time for each script needs to be shorter than the TIMEOUT attribute value of attribute that users have set.
If the processing time of scripts exceeds the TIMEOUT attribute value, PRIMECLUSTER determines it is a resource error and stop the startup and stop processings.
An example of the Check script other than Hot-standby operation indicates as follows.
The following example assumes that the setting has already described in 6.11.2.1.1 Examples of start and stop Scripts."
If performing Hot-standby operation in the Cmdline resource, describe the Check script, which is similar to the start and stop scripts, corresponding to Hot-standby operation
Below is an example of the Check script corresponding to Hot-standby operation.
The following example assumes that the setting has already described in 6.11.2.1.1 Examples of start and stop Scripts."
The following environment variables are set when executing the Check script. These environment variables can be referred to within the script.
HV_APPLICATION
HV_NODENAME
See
For outlines on these environment variables, see "Table 6.5 Environment variables that can be referred to within the Start and Stop scripts."
And, for details on the RMS environment variables, see "Appendix E Environment variables" in "PRIMECLUSTER Reliant Monitor Services (RMS) with Wizard Tools Configuration and Administration Guide."
The exit codes of the Check script vary depending on whether performing Hot-standby operation or not.
Use any one of the following exit codes.
Exit code | Meaning |
---|---|
0 | Online state. If a target to be monitored has started, use this exit code. |
Other than 0 | Offline state. If a target to be monitored has stopped, use an exit code other than 0. If it completes in Offline after it has become Online, a switchover is performed. |
Use any one of the following exit codes.
Exit code | Meaning |
---|---|
0 | Online state. If a target to be monitored has started, use this exit code. |
1 | Offline state. If a target to be monitored has stopped, use this exit code. If it completes in Offline after it has become Online, a switchover is performed. |
2 | Faulted state. If a target to be monitored has faulted, use this exit code. If it completes in Faulted after it has become Online, a switchover is performed. |
4 | Standby state. If a target to be monitored has been Standby state, use this exit code. |
Note
Since the exit codes other than the above indicate the specific status, use these codes only when applicable products are specified in the environment that uses PRIMECLUSTER products.
If the cluster application needs to be switched due to a resource error when the Check script processing is not completed within the specified time, set the CheckCommandTimeouts attribute of the Cmdline resource. Specify the time to determine a resource error if the Check script processing is not completed in seconds. By default, "none" is set, which means that a resource error does not occur.
The settable value is "none" or in the range of 45 seconds to 3600 seconds.