Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

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

tryto(1)						      General Commands Manual							  tryto(1)

NAME
tryto - tries to run a command limited by a timeout or number of tries, can be used to run as svlogd(8) processor. SYNOPSIS
tryto [-pPv] [-t sec] [-k ksec] [-n tries] prog DESCRIPTION
prog consist of one or more arguments. tryto runs and watches prog, feeding its standard input to prog's standard input. If prog exits with a return code other then 0, tryto runs prog again after sleeping one second. If the number of retries reaches the maximal number of tries, tryto prints an error message and gives up. If the timeout sec seconds is reached and prog is still running, tryto sends a TERM signal to prog, waits ksec seconds for prog to termi- nate, then sends a KILL signal if prog still is there, and exits as soon as possible. OPTIONS
-t sec timeout. Set the timeout to send TERM to prog to sec seconds. Default is 180. -k ksec kill timeout. Set the timeout to send KILL to prog to ksec seconds. Default is 5. -n tries Set the maximal number of tries to tries. If prog exited with a return code other that 0, tryto tries to rewind standard input to the beginning using lseek(2) before starting prog again. Default is 5. -p processor. Use this option if you run tryto as a svlogd(8) processor (see below). -P process group. Run prog in a new session and process group, and send signals on timeout to prog's process group instead of its pid. -v verbose. Print verbose messages to standard error. PROCESSOR
If tryto sees the -p option, tryto runs as a svlogd(8) or multilog(8) processor, making use of filedescriptors 4 and 5: Before starting prog, tryto moves the filedescriptor 5 to 2, so all error messages from tryto and prog will be saved in svlogd(8)'s state to be processed on the next run of tryto -p. After starting prog, tryto first feeds all data it reads from filedescriptor 4 into prog's standard input, then all data from filedescrip- tor 0. If prog fails by timeout sec seconds or maximal number of tries, tryto prints all data from standard input to standard output, an error message to standard error, and exits with 0. EXIT CODES
If tryto itself fails, it returns 111. If tryto runs as a svlogd(8) processor, tryto returns 0 in all other cases. If prog was run successfully, tryto returns 0. If prog failed by timeout, tryto returns 100. If prog failed by maximal number of tries, tryto returns the last return code from prog. SEE ALSO
socklog(8), uncat(1), svlogd(8), multilog(8), lseek(2) http://smarden.org/socklog/ http://smarden.org/runit/ AUTHOR
Gerrit Pape <pape@smarden.org> tryto(1)
Man Page