-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhatimerun.1.in
More file actions
133 lines (129 loc) · 3.59 KB
/
hatimerun.1.in
File metadata and controls
133 lines (129 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
.\" $Id$
.TH hatimerun 1 "$Date$" "V@VERSION@" "HA-Tools"
.SH NAME
hatimerun \- Run command with a timeout.
.SH SYNOPSIS
.B hatimerun
[\c
.B -a\c
] [\c
.BI -e " exitcode"\c
] [\c
.BI -k " sig"\c
] \c
.BI -t " [[hh:]mm:]secs"\c
.I " command"\c
[\c
.I args\c
]\c
.br
.B hatimerun
[\c
.B -l\c
|\c
.B -h\c
|\c
.B -?\c
]
.SH DESCRIPTION
Executes the given
.I command
with the given
.I args
with a timeout of
.I secs
seconds.
If the new process doesn't terminate before a timeout
exceeds
.B hatimerun
sends the process a signal.
.P
The
.I command
is run in its own process group, the termination signal is sent to this process group.
.P
.I hatimerun
will always wait for the child to terminate, even if the timeout occurred but
the child didn't terminate on the signal.
.P
The
.I hatimerun
process which waits for the child to exit ignores the following signals:
TERM, HUP, INT, PIPE, QUIT, USR1 and USR2.
.TP
.BI -t " [[hh:]mm:]secs"
Specifies the time the command has to finish before a signal will be sent. You can specify the timeout value in seconds or hours:minutes:seconds notation.
.br
Multiple occurrences of -t are supported. Every time a specified timeout happens a new signal is sent to the child. See EXAMPLES section for more info.
.TP
.BI -k " sig"
Specifies the signal witch will be sent to the process group if a timeout occurs. Multiple occurrences of -k are supported. In case multiple -t arguments are specified every time a new timeout happens the next specified signal will be sent. if there are less -k arguments then -t arguments specified the missing signals are defaulted to SIGKILL. See EXAMPLES section for more info.
Default:
.B "SIGKILL"\c
.TP
.BI -e " exitcode"
Changes the exitcode returned by
.B hatimerun
on timeout (if the program ends normally or abnormally after the first signal was sent) to
.I exitcode
Multiple occurrences of -e are supported in connection with multiple occurrences of -t.
Default:
.B 99
.TP
.B -a
Starts
.B hatimerun
in the background. The hatimerun program exits immediately. The return code of the executed command is lost.
.TP
.B -l
Prints list of available symbolic signal names on this platform and exits.
.TP
.B -h | -?
Prints a help screen and exits.
.SH "RETURN VALUE"
If the command terminates normally before the first timeout happened,
On success
.B hatimerun
returns the return value of the given
.I command
.PP
After the first timeout happened
.B hatimerun
returns the value specified by the respective
.I \-e
option or
.B 99
per default.
.B hatimerun
will always wait for the program to terminate, even if the program terminates normally after the first signal was sent,
.B hatimerun
will return the respective error code as return value and the exit code of the command is lost.
.SH EXAMPLES
hatimerun \-t 5 sleep 10
.RS 3
Will kill the sleep command after 5 seconds
.RE
.PP
hatimerun -k TERM -t 5 sleep 10
.RS 3
Will send the TERM signal after 5 seconds
.RE
.PP
hatimerun -k TERM -t 5 -e 100 -e 101 -t 1 sleep 10
.RS 3
Will send the TERM signal after 5 seconds, and (if the command didn't finish till then) send the KILL signal one second later (about 6 seconds after program start). Will return 100 if the program was terminated by the TERM signal or 101 if it was terminated by the KILL signal.
.RE
.PP
hatimerun -k HUP -t 1 nohup sleep 1000
.RS 3
Will send a HUP signal after one second and then wait (potentially forever) until the child terminates.
.RE
.PP
hatimerun -k TERM -t 1:30 sleep 120
.RS 3
Will send the TERM signal after one minute and 30 seconds (90 seconds).
.RE
.SH AUTHOR
Copyright (c) 2001,2003,2005-2009 by Markus Winand <mws@fatalmind.com>
.SH SEE ALSO
.IR halockrun (1)