![[jump to content]](_.gif)
Tools (new)
: timeout
[ Home
| Scylla+Charybdis old home
| Tools (old)
| Tools (new)
| FAQ
| Downloads
]
Moving to GitHub, slowly
The software on this pages will slowly be moved to GitHub https://github.com/hilbix/.
The CVS repository will be migrated to GIT as well, so the history will be preserved, a bit. See FAQ.
Scylla and Charybdis, timeout - Tools
The tools are developed under Linux with
ESR's paradigm
release early, release often
in mind.
So you can consider this beta software, or alpha, or pre-alpha, or even worse ;)
Have a look in the download directory for all downloads.
As always here, all you get is the source. No binaries here.
timeout 0.0.3-20101021-011348
Execute a command or pipe only for a given duration.
⇒ ⇒ ⇒ The development shifted to another location. All future versions will be published at https://github.com/hilbix/timeout
⇐ ⇐ ⇐
Timeout is a complete rewrite of a program which I had before. It is
used to restrict the time duration a program runs. Note that the
"timeout" command which comes with Debian Etch is seriously broken,
therefor I had to create this one here.
Just call it as
timeout [-v] [-signal[@seconds]...] seconds [-|program [args...]]
- If -v is present, verbose information is printed.
- If -v is doubled, the current timeout is shown.
- Returns the exit status of the program, 127 if child exec fails, 210 on error from timeout (like usage).
- If execution takes longer than the given number of seconds,
timeout terminates the program and returns 255.
- If signals are given, the signals are sent to the program with
the given delay between. The default is -1 -15 -9 and a one second
delay.
- If program is missing it works like /bin/cat. In this case, it
just terminates after the given duration with exit status 211.
- If program is given as '-' the timeout occurs after a silence
phase of the given duration. Silence is either reading or writing
starves.
Future (not yet implemented) plans:
- Seconds can hava a fraction. This is no real floating point
number.
- On HUP or TERM, the timeout cycle for signals is started.
- If program is given as '-number' then the process is attached to
and the signal is sent to the process after this time if the process
still exists (is like a delayed kill). This is free from race
conditions like "sleep $timeout; kill -9 $pid".
- Allow '-[n]:program' to check stdin, stdout or stderr for silence
(pipe)
- Implement gerneric extended socket processing, this is, program
can be given as connect:host:port or connect:/unixsocket etc. If
prefixed with - it, again, monitors for silence. This shall work for
"exec:"- and "pty:"-URLs, too, which open a socket to a process.
Examples:
- timeout 5
same as 'sleep 5'
- timeout 5 < /var/log/messages
same as 'sleep 5 & tail -+0 --pid=$! -f /var/log/messages'
- timeout 5 - < /var/log/messages
nearly the same as
'cat /var/log/messages | while read -t5 data; do echo "$data"; done'
- timeout 5 ls
nearly same as
'ls & PID=$!; { sleep 5; kill $PID; } & PID2=$!; wait $PID; kill
$PID2'
(Please note that 'ls & PID=$!; sleep 5; kill $PID' would always delay
5 seconds.)
History:
|
download (252982 bytes) sig
|
Fixes for wrong return values.
Returns 127 in case of child exec fails.
Returns 210 on fork fails as it ought to (instead of -1 previously)
As always, nearly not tested at all.
|
|
download (228934 bytes) sig
|
Minor bugfix for output in pipe case
|
|
download (226025 bytes) sig
|
Bugfix: Idle mode was inverted
|
|
(225939 bytes archive)
|
I needed this version as a replacement for the broken variant
which comes with Debian Etch (which does not return the
return value of the forked command).
|
License and Disclaimer
All you can see here is free software according to the GNU GPL.
Copyright (C)2000-2011 by Valentin
Hilbig
Note that the software comes with absolutely no warranty of any kind.
You use the software at your own risk.
Valentin Hilbig cannot be hold responsible for any unintended damage,
lost data or malfunction of the software you can find here.
|
|
![[end of page - jump back to content]](_.gif)
![[hacker culture]](glider-small.png)
Last modified: 2011-09-12 by Valentin Hilbig
[ Imprint
/ Impressum
]