1hatimerun(1)                       HA-Tools                       hatimerun(1)
2
3
4

NAME

6       hatimerun - Run command with a timeout.
7

SYNOPSIS

9       hatimerun [-a] [-e exitcode] [-k sig] -t secs command [args]
10       hatimerun [-l|-h|-?]
11

DESCRIPTION

13       Executes  the  given command with the given args with a timeout of secs
14       seconds.  If the new process doesn't terminate before a timeout of secs
15       exceeds hatimerun sends the process a signal.
16
17       The  command is run in its own process group, the termination signal is
18       sent to this process group.
19
20       hatimerun will always wait for the child  to  terminate,  even  if  the
21       timeout occurred but the child didn't terminate on the signal.
22
23       The  hatimerun  process  which  waits for the child to exit ignores the
24       following signals: TERM, HUP, INT, PIPE, QUIT, USR1 and USR2.
25
26       -t secs
27              Specifies the time the command has to  finish  before  a  signal
28              will  be  sent.  Multiple occurrences of -t are supported. Every
29              time a specified timeout happens a new signal  is  sent  to  the
30              child. See EXAMPLES section for more info.
31
32       -k sig Specifies  the signal witch will be sent to the process group if
33              a timeout occurs. Multiple occurrences of -k are  supported.  In
34              case  multiple -t arguments are specified every time a new time‐
35              out happens the next specified signal will be sent. if there are
36              less  -k  arguments then -t arguments specified the missing sig‐
37              nals are defaulted to SIGKILL. See  EXAMPLES  section  for  more
38              info.
39
40              Default: SIGKILL
41
42       -e exitcode
43              Changes  the  exitcode  returned by hatimerun on timeout (if the
44              program ends normally or abnormally after the first  signal  was
45              sent)  to  exitcode  Multiple occurrences of -e are supported in
46              connection with multiple occurrences of -t.
47
48              Default: 99
49
50       -a     Starts hatimerun in the background. The hatimerun program  exits
51              immediately. The return code of the executed command is lost.
52
53       -l     Prints  list of available symbolic signal names on this platform
54              and exits.
55
56       -h | -?
57              Prints a help screen and exits.
58

RETURN VALUE

60       If the command terminates normally before the first timeout happend, On
61       success hatimerun returns the return value of the given command
62
63       After  the  first timeout happend hatimerun returns the value specified
64       by the respective -e option or 99 per default.  hatimerun  will  always
65       wait  for the program to terminate, even if the program terminates nor‐
66       mally after the first  signal  was  sent,  hatimerun  will  return  the
67       respective  error code as return value and the exit code of the command
68       is lost.
69

EXAMPLES

71       hatimerun -t 5 sleep 10
72          Will kill the sleep command after 5 seconds
73
74       hatimerun -k TERM -t 5 sleep 10
75          Will send the TERM signal after 5 seconds
76
77       hatimerun -k TERM -t 5 -e 100 -e 101 -t 1 sleep 10
78          Will send the TERM signal after  5  seconds,  and  (if  the  command
79          didn't  finish  till  then)  send  the  KILL signal one second later
80          (about 6 seconds after program start). Will return 100 if  the  pro‐
81          gram  was  terminated by the TERM signal or 101 if it was terminated
82          by the KILL signal.
83
84       hatimerun -k HUP -t 1 nohup sleep 1000
85          Will send a HUP signal after one second and then  wait  (potentially
86          forever) until the child terminates.
87
88

AUTHOR

90       Copyright (c) 2001,2003,2005-2007 by Markus Winand <mws@fatalmind.com>
91

SEE ALSO

93       halockrun(1)
94
95
96
97V2.00                    $Date: 2007/08/18 14:08:20 $             hatimerun(1)
Impressum