Nov 7, 2017

Timeout a Linux command

Run a command with a time limit, runs the given command and kills it if it is still running after the specified time interval.
       timeout [option] duration command [arg]...
duration is a floating point number followed by an optional unit:

       ‘s’ for seconds (the default)
       ‘m’ for minutes
       ‘h’ for hours
       ‘d’ for days

Run a command (LongRunningCommand) and timeout after 1 minute if the process has not completed already:

$ timeout 1m LongRunningCommand

Apply a 48 second time out to a crontab task

$ * * * * * cronuser timeout 48 demo-script

Post a Comment

Featured Post

Setup Chinese Input Method in Ubuntu 17.10 Artful

sudo apt install ibus-sunpinyin After either of those commands do not forget to restart the IBus daemon ibus restart You might need t...