1 .TH "timeout" 1 "5 June 2011" "Mark Wooding" "Toys"
3 timeout \- run a program for at most a given amount of time
16 command runs a specified program for at most a given number of
19 It works by running the given command as a separate process group. It
20 then waits either for the top-level process (only) to exit, or for the
21 timeout to expire, whichever happens first. If the process exits, then
23 exits too, setting its exit status to match. Any other processes which
24 may have been started are left unmolested.
26 On the other hand, if the timeout goes off, then
28 sends its child process group the specified signal, by default
30 though you can choose a different one with the
32 option. It then waits an additional five seconds. If the child still
33 hasn't exited, it sends
35 to the process group and waits a further five seconds. If the child
36 still hasn't exited in this time, then
40 The following command-line options are recognized.
43 Prints a reasonably full help message describing the arguments and
44 options to standard output, and exits successfully.
47 Prints the program's version number to standard output, and exits
51 Prints a brief usage summary to standard output, and exits successfully.
53 .BI "\-s, \-\-signal=" signal
56 to the child process if it takes too long. The default is to send
58 A signal may be given numerically (e.g., 9 for
66 works by running its child process in a separate process group, it
67 interacts oddly with interactive shells. If the child process group
68 attempts to do terminal I/O (particularly reading from a terminal) then
69 it may be sent signals to suspend it. This may or may not make matters
74 program makes an effort to propagate interesting signals to its child
75 process group. Currently, it propagates
82 This list is subject to change: I don't think I'm likely to remove any
83 of the current signals from it, but I might add some; or I might add an
84 option to control this list.
88 and its child process group, the timer continues running anyway. (I'm
89 not quite sure whether this is the right behaviour.)
91 Nested timeouts don't work in a useful way if the outer timeout expires
92 earlier than the inner one. Since
94 isn't propagated (currently, at least), the inner
96 is killed by the outer one, and loses control of its child process
97 group. You could possibly work around this by sending
101 Perhaps it would be useful to allow configuration of the `panic'
102 timeouts after the initial timeout signal is sent.
105 Mark Wooding, <mdw@distorted.org.uk>