Previous: su invocation, Up: Modified command invocation


23.7 timeout: Run a command with a time limit

timeout runs the given command and kills it if it is still running after the specified time interval. Synopsis:

     timeout [option] number[smhd] command [arg]...

number is an integer followed by an optional unit; the default is seconds. The units are:

s
seconds
m
minutes
h
hours
d
days

command must not be a special built-in utility (see Special built-in utilities).

The program accepts the following option. Also see Common options. Options must precede operands.

-s signal
--signal=signal
Send this signal to command on timeout, rather than the default ‘TERM’ signal. signal may be a name like ‘HUP’ or a number. Also see See Signal specifications.

Exit status:

     124 if command times out
     125 if timeout itself fails
     126 if command is found but cannot be invoked
     127 if command cannot be found
     the exit status of command otherwise