hatimerun(1)
okay bestie, sit down, hydrate ๐ this is hatimerun(1), a page straight out of the hatools manual, and it's literally the timeout queen of your process table ๐
๐ธ NAME ๐ธ
hatimerun โ Run command with a timeout. that's it, that's the whole job, and she does it flawlessly ๐
โจ SYNOPSIS โจ
hatimerun [-av] [-e exitcode] [-k sig] -t [[hh:]mm:]secs command [args]
hatimerun [-l|-h|-?]
๐ DESCRIPTION ๐
So the whole thing is: she runs command args with a timeout of [[hh:]mm:]secs seconds. If command is still being dramatic and hasn't terminated before the timeout hits, hatimerun sends a signal to command. no cap ๐ซถ
Command gets started in its own process group, and guess what โ the signal gets sent to the process group. group chat behaviour fr fr ๐
Here's the iconic part: hatimerun herself will not terminate while command is running โ not even if the timeout already happened. She terminates when command terminates. main character waits for her friend, always ๐ฅน
She can also be configured to send a sequence of different signals to command, so you get a graceful termination and still get a hard timeout with the KILL signal at the end. peek the EXAMPLES below for the tea ๐
hatimerun herself ignores these signals so nobody can prematurely end her: TERM, HUP, INT, PIPE, QUIT, USR1 and USR2. she's unbothered, moisturized, in her lane โจ
-t [[hh:]mm:]secsโ the timeout, periodt. specifies the time when the signal is sent, ifcommanddidn't terminate before that. you can pass multiple-tand that's fully supported โ every time a specified timeout happens, a new signal is sent to the child. see EXAMPLES ๐-k sigโ picks the signal that gets sent on timeout. multiple-koccurrences are supported so you can set different signals for different timeouts, iykyk: the second-ksignal goes out on the second timeout, and so on. and if there are fewer-karguments than timeouts (-t),hatimerunsendsSIGKILLat the additional timeouts. see EXAMPLES below ๐ symbolic and numeric signal specs are both accepted. the "magic" signal nameNONEsends no signal at all, which is lowkey perfect in combination with-v.
Default: SIGKILL
-e exitcodeโ changes the exit codehatimerunreturns on timeout. this code kicks in as soon as the first timeout has passed, irrespective of the exit status ofcommand. multiple-eoccurrences are supported in connection with multiple-toccurrences.
Default: 99
-aโ startshatimerunin the background.hatimerunherself exits immediately. the exit code ofcommandis lost. gone. no thoughts head empty ๐-lโ prints the list of available symbolic signal names on this platform and exits. very helpful, very demure ๐-vโ verbose mode. prints a message containing the runtime if the first timeout passed beforecommandterminated. super useful incronso you actually get an e-mail sent when a timeout has passed by. you can pair this with the-k NONEswitch to just print an error message on timeout and not killcommand. gentle queen ๐ธ-vvโ more verbose mode, basically almost debug mode. writes a status message on every timeout. she's telling you everything ๐-h | -?โ prints a help screen and exits ๐ซถ
๐ฅ RETURN VALUE ๐ฅ
If the command terminates normally before the first timeout happened: on success, hatimerun returns the return value of the given command. slay, business as usual โจ
After the first timeout has happened, hatimerun returns the value specified by the respective -e option, or 99 per default. and listen โ hatimerun will always wait for the program to terminate. even if the program terminates normally after the first signal was sent, hatimerun will return the respective error code as its return value, and the exit code of the command is lost. that code is not coming back bestie, it's gone ๐
๐ EXAMPLES ๐
the classic:
hatimerun -t 5 sleep 10
Will kill the sleep command after 5 seconds. bye ๐
the gentle one:
hatimerun -k TERM -t 5 sleep 10
Will send the TERM signal after 5 seconds.
the two-step, graceful-then-nuclear:
hatimerun -k TERM -t 5 -e 100 -e 101 -t 1 sleep 10
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. the escalation timeline ๐
the patient one:
hatimerun -k HUP -t 1 nohup sleep 1000
Will send a HUP signal after one second and then wait (potentially forever) until the child terminates. she said take your time ๐ฅน
the "yes, you can do minutes" one:
hatimerun -k TERM -t 1:30 sleep 120
Will send the TERM signal after one minute and 30 seconds (90 seconds). math ate, no crumbs ๐งฎ
๐ AUTHOR ๐
Copyright (c) 2001,2003,2005-2010 by Markus Winand <mws@fatalmind.com>
๐ฆ SEE ALSO ๐ฆ
halockrun(1) โ her sister, go say hi ๐ซถ
Version V2.14, dated 2010-03-16 โ that's the whole page bestie, go forth and timeout responsibly ๐โจ๐๐ฆ
๐ฆ where this page comes from
- fedora 43: hatools 2.14-29.fc43 ยท GPL-2.0-or-later
- fedora 44: hatools 2.14-30.fc44 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms