ptimeout - time out a command, reporting errors
ptimeout 1h long_running_command ptimeout 60m long_running_command ptimeout 3600 long_running_command
Takes two or more arguments. The first is the timeout, an integer. With no suffix this is a number of seconds. Can also take suffixes m or h indicating a number of minutes or hours.
m
h
The rest is a command and its arguments.
A watchdog process is immediately forked off, and then the command is run in the foreground.
If that command exits before the timeout, ptimeout will kill the watchdog and then replicate the command's exit status in its own.
ptimeout
If the timeout is reached and the command is still running then the watchdog will kill it (using SIGTERM) and all its child processes that can be found, and ptimeout will exit with status 124.
This does not reliably kill child processes in all circumstances.
Doesn't work properly on OpenBSD and I have no idea why.
Please report any bugs you find on Github:
https://github.com/DrHyde/perl-modules-App-ptimeout/issues
git://github.com/DrHyde/perl-modules-App-ptimeout.git
Copyright 2023 David Cantrell <david@cantrell.org.uk>
This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
This is also free-as-in-mason software.
To install App::ptimeout, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::ptimeout
CPAN shell
perl -MCPAN -e shell install App::ptimeout
For more information on module installation, please visit the detailed CPAN module installation guide.