Go to main content

Reference for Oracle Solaris Cluster 4.4

Exit Print View

Updated: August 2018
 
 

hatimerun (8)

Name

hatimerun - run child program under a timeout

Synopsis

/usr/cluster/bin/hatimerun -t timeOutSecs [-adv] [-e exitcode] 
[–x timeOutThresholdPercentage] prog args
/usr/cluster/bin/hatimerun -t timeOutSecs [-dv] [-e exitcode] 
[-k signalname] [–x timeOutThresholdPercentage] prog args

Description

The hatimerun utility provides a convenient facility for timing out the execution of another child program. It is useful when programming in scripting languages, such as the Bourne shell. See sh(1).

The hatimerun utility runs the program prog with arguments args as a child subprocess under a timeout, and as its own process group. The timeout is specified in seconds, by the –t timeOutSecs option. If the timeout expires, then hatimerun kills the child subprocess's process group with a SIGKILL signal, and then exits with exit code 99.

Options

The following options are supported:

–a

Changes the meaning of hatimerun radically: instead of killing the child when the timeout expires, the hatimerun utility simply exits, with exit code 99, leaving the child to run asynchronously.

It is illegal to supply both the –a option and the –k option.

–d

Enables a timeout delay. This option delays starting the timeout clock until the program _prog_ has begun executing. On a heavily loaded system, there can be seconds of delay between the time that the child process is forked and the time that the designated program begins to execute. Using the –d option avoids counting that additional pre-execution time against the allotted timeout period.

–e

Changes the exit code for the timeout case to some other value than 99.

–k

Specifies what signal is used to kill the child process group. The possible signal names are the same as those recognized by the kill(1) command. In particular, the signal name should be one of the symbolic names defined in the <signal.h> description. The signal name is recognized in a case-independent fashion, without the SIG prefix. It is also legal to supply a numeric argument to the –k option, in which case that signal number is used.

It is illegal to supply both the –a option and the –k option.

–t

Specifies the timeout period, in seconds.

–v

Verbose output, on stderr.

–x

If the time consumed by the child process of the hatimerun utility exceeds the value of the following formula without causing a timeout, hatimerun prints to stderr the percentage of timeOutSecs that the child process consumed:

timeOutSecs x timeOutThresholdPercentage

Exit Status

If the timeout occurs, then hatimerun exits with exit code 99 (which can be overridden to some other value using the –e option).

If the timeout does not occur but some other error is detected by the hatimerun utility (as opposed to the error being detected by the child program), then hatimerun exits with exit code 98.

Otherwise, hatimerun exits with the child's exit status.

The hatimerun utility catches the signal SIGTERM. It responds to the signal by killing the child as if a timeout had occurred, and then exiting with exit code 98.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
ha-cluster/system/core
Interface Stability
Evolving

See Also

kill(1), sh(1), scds_timerun(3HA), attributes(7)