Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle Solaris Cluster Reference Manual Oracle Solaris Cluster 4.1 |
scds_get_current_method_name(3HA)
scds_get_resource_group_name(3HA)
scds_get_resource_type_name(3HA)
scds_get_rg_hostnames_zone(3HA)
scha_cluster_getlogfacility(3HA)
scha_resourcegroup_get_zone(3HA)
scha_resourcegroup_open_zone(3HA)
scha_resource_setstatus_zone(3HA)
scha_resourcetype_get_zone(3HA)
- wait for the specified timeout period for a monitored process to die
cc [flags…] -I /usr/cluster/include file -L /usr/cluster/lib -l dsdev #include <rgm/libdsdev.h> scha_err_t scds_svc_wait(scds_handle_t handle, time_t timeout);
The scds_svc_wait() function waits for the specified timeout period for a monitored process group to die. It waits upon all process groups started by scds_pmf_start(3HA) for the resource passed to the calling START method. The scds_svc_wait() function uses the Retry_interval and Retry_count properties of the resource to limit the number of process deaths to wait on. If the number of process deaths during Retry_interval reaches the value of Retry_count, scds_svc_wait() returns with SCHA_ERR_FAIL.
If the number of process failures is below the value of Retry_count, the process is restarted and scds_svc_wait() waits the full timeout period for further process deaths. The counting of process failures spans successive calls to scds_svc_wait().
The following parameters are supported:
The handle returned from scds_initialize(3HA)
Timeout period measured in seconds
The scds_svc_wait() function returns the following:
The function succeeded.
The function failed.
The function timed out.
No process deaths occurred, or a process was successfully restarted.
The number of failures reached the value of the Retry_count property.
A system error or an otherwise unexpected error occurred.
See scha_calls(3HA) for a description of other error codes.
Example 1 Using scds_svc_wait() in a START Method
The following example shows how you could use scds_svc_wait in a START method to return early if the service fails to start. After starting an application process with scds_pmf_start(), a START method must wait for the application to fully initialize itself and become available before returning success. If the application fails to start, the START method must wait the entire Start_timeout period before returning with failure. Using scds_svc_wait(), as in the following example, allows START methods to restart applications up to Retry_count times and return early with failure from the START method if the service is unable to start up.
/* * scds_svc_wait is a subroutine in a START method to * check that the service is fully available before returning. * Calls svc_probe() to check service availability. */ int svc_wait(scds_handle_t handle) { while (1) { /* Wait for 5 seconds */ if (scds_svc_wait(handle, 5) != SCHA_ERR_NOERR) { scds_syslog(LOG_ERR, "Service failed to start."); return (1); /* Start Failure */ } /* Check if service is fully up every 5 seconds */ if (svc_probe(handle) == 0) { scds_syslog(LOG_INFO, "Service started successfully."); return (0); } } return (0); }
Include file
Library
See attributes(5) for descriptions of the following attributes:
|
scds_initialize(3HA), scds_pmf_start(3HA) , scha_calls(3HA), attributes(5), r_properties(5)
If the START method exceeds the Start_timeout setting on the resource, the Resource Group Manager (RGM) kills the START method even if the START method is currently waiting for scds_svc_wait() to return.
If Retry_interval on the resource is larger then Start_timeout, the START method could be timed out by the RGM even if the number of failures is below Retry_count.
If a START method starts multiple process groups with multiple calls to scds_pmf_start(), scds_svc_wait() starts process groups as they die. It does not enforce any dependencies between process groups. Do not use scds_svc_wait() if there is a dependency between process groups such that failure of one process group requires a restart of other process groups. Instead, use sleep() to wait between health checks of the process groups.