Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 475 Bytes

timeout.md

File metadata and controls

18 lines (13 loc) · 475 Bytes

Run a command for some time

Today I had to run a script for a limited amount of time before asking it to terminate. I came across a really handy command line tool already available with the GNU/Linux - timeout.

Running a command for a fixed time is as easy as this:

timeout 5s scrapy crawl

$ timeout --help
Usage: timeout [OPTION] DURATION COMMAND [ARG]...
  or:  timeout [OPTION]
Start COMMAND, and kill it if still running after DURATION.

Happy hacking!