hatimerun(1m) [opensolaris man page]
hatimerun(1M) System Administration Commands hatimerun(1M) NAME
hatimerun - run child program under a timeout SYNOPSIS
/usr/cluster/bin/hatimerun -t timeOutSecs [-av] [-e exitcode] prog args /usr/cluster/bin/hatimerun -t timeOutSecs [-v] [-e exitcode] [-k signalname] 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. You can run this command in the global zone or in a non-global zone. The command affects only the global or non-global zone in which you issue the command. 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 sim- ply exits, with exit code 99, leaving the child to run asynchronously. It is illegal to supply both the -a option and the -k option. -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> descrip- tion. 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. 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 hatimerunhatimerun 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(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
kill(1), sh(1), attributes(5) Sun Cluster 3.2 10 Apr 2006 hatimerun(1M)
Check Out this Related Man Page
ctrun(1) User Commands ctrun(1) NAME
ctrun - execute command in a process contract SYNOPSIS
/usr/bin/ctrun [options] command [ argument...] DESCRIPTION
The ctrun utility starts a command in a newly created process contract. ctrun holds the contract and can be instructed to output or respond to events that occur within the contract. For additional information about process contracts, see contract(4) and process(4). OPTIONS
The following options are supported: -i event,[event ...] -f event,[event ...] Sets the informative and fatal events, respectively. The following are valid events: core A member process dumped core. core events are informative by default. empty The last member of the process contract exited. exit A member process exited. fork A process was added to the process contract. hwerr A member process encountered a hardware error. hwerr events are fatal by default. signal A member process received a fatal signal from a process in a different process contract. Only core, hwerr, and signal events can be made fatal. More events can be delivered than requested if ctrun requires them for its own purposes. For example, empty messages are always requested if a lifetime of contract is specified. See -l. -l lifetime The following valid lifetime values are supported: child ctrun exits when the command exits, regardless of whether the contract is empty. contract ctrun exits only when the contract exits. This is the default. none ctrun exits immediately, orphaning the contract. -o option,[option ...] The following options are supported: noorphan Kills all processes in the contract if the holder (ctrun) exits. This option is invalid when a lifetime of none is specified. pgrponly If a fatal error occurs, kills at most the process group of which the errant process is a member. regent The contract inherits inheritable contracts when abandoned by member processes. -r count If the contract encounters a fault, this option attempts to restart the command count times. If count is 0, the attempt to restart con- tinues indefinitely. By default, ctrun does not attempt to restart the command. This option is invalid if a lifetime other than contract is specified or if the pgrponly option is used. -t If the contract created by ctrun inherited subcontracts from its member processes, attempts to transfer them to the new contract when restarting. This option is invalid unless -r is also specified. -v Displays contract events and ctrun actions as they occur. -V Displays verbose contract events, as are displayed by the -v option of ctwatch. Implies -v. OPERANDS
The following operands are supported: argument One of the strings treated as an argument to command. command The command to be passed to execvp(2). See exec(2). EXAMPLES
Example 1: Running a Shell in a New Process Contract The following example runs a shell in a new process contract: example% ctrun -l child -o pgrponly ksh The -l child option argument is specified so that ctrun won't wait until all children of the shell have exited. -o pgrponly is specified because an interactive ksh puts each job in a new process group, and an error in one job is unlikely to affect the others. Example 2: Running a Simple Server The following example runs a simple server: example% ctrun -r 0 -t -f hwerr,core,signal server The -r 0 and -t options are specified to indicate that if the server encounters a fatal error, ctrun should try to restart it. The -f option makes "hwerr", "core", and "signal" fatal events. EXIT STATUS
If command is specified and successfully invoked (see exec(2)), the exit status of ctrun is the exit status of command. Otherwise, ctrun exits with one of the following values: 123 The child process exited abnormally. 124 ctrun encountered an internal error. 125 Invalid arguments were provided to ctrun. 126 command was found but could not be invoked. 127 command could not be found. FILES
/system/contract/process/* ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |See below. | +-----------------------------+-----------------------------+ Human Readable Output is Unstable. Invocation is Evolving. SEE ALSO
ctstat(1), ctwatch(1), exec(2), contract(4), process(4), attributes(5) SunOS 5.10 15 Jul 2004 ctrun(1)