FINITE

Section: User Commands (1)
Updated: September 2001
 

NAME

finite - run a command for a limited time, then kill with signal  

SYNOPSIS

finite [ -{i|I} signal_list ] [ -f ] time signal command [ args ]

finite -h  

DESCRIPTION

finite -h prints a help message and exits.

Otherwise, finite runs `command [ args ]`. After time ammount of time finite sends signal to the process group of command. It then waits up to 5 seconds for command to exit. If command does not exit within 5 seconds, finite sends a SIGTERM, and, after 2 more seconds, a SIGKILL.  

OPTIONS

-{i|I}
This option can be used to specify a list of signals that should have default behavior set to ignore before execve(2)ing command. Signals can be specified by case insensitive name or number, and can be a comma separated list with ranges. For example:

finite -i HUP-sigquit,13,30-31,SIGTERM 1m SIGABRT foo -options

will set the dafault behavior for SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGUSR1, SIGUSR2, and SIGTERM to ignore before execve(2)ing `foo -options`.

Multiple -i options are valid. The behavior of the following will be identical to the previous example:

finite -iHUP-sigquit -i13 -i30-31 -iSIGTERM 1m SIGABRT foo -options

Note that, as above, signal_list does not need to be separated from -i by whitespace.

The difference between -i and -I is that -i will ignore the listed signals in addition to any inherited as ignored from finite's parent, whereas -I will ignore only the listed signals, resetting all others to the default behavior. In the case of multiple -{i|I} options, this behavior is taken from the last one.


-f
By default, if signal, SIGTERM or SIGKILL are ignored, either through the -{i|I} option or the behavior inherited by finite, finite will print an error message and exit. The -f option tells finite to go ahead anyway.
 

TIME FORMAT

finite uses a time format similar to that used by w(1) to print idle time. It consists of up to 4 colon-separated integers, optionally followed by a lowercase letter; everything after is ignored. It is interpreted as follows:

<days>d or
[<days>:]<hours>h or
[[<days>:]<hours>:]<minutes>m or
[[[<days>:]<hours>:]<minutes>:]<seconds>[s]

No range checking is preformed except to make sure values are not negative, so 50h or 120m or 500:1234s are perfectly legal (though it's up to you to figure out what some of the more bizzare combinations will do). Note, since finite ignores all letters after the first, the following are equivalent:

50m
50minutes
50mountains
50mAnGoEs  

RETURN VALUE

finite returns:
0
if all the setup was OK, and command terminated before time ran out, or if the -h option was used.
1
if all the setup was OK, and command terminated after signal was sent.
2
if all the setup was OK, but finite had to send a SIGTERM to have command die.
3
if all the setup was OK, but finite had to send a SIGKILL to have command die.
4
if the execve(2) for command failed.
5
if signal, SIGTERM or SIGKILL was ignored, but -f was not specified.
6
if signal is not a valid signal.
7
if parsing of time failed.
8
if parsing of signal_list failed.
9
if an unknown option is present.
 

AUTHOR

Alexey Toptygin <alexeytATfreeshell.org>  

SEE ALSO

signal(7), execve(2), killpg(2)


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
TIME FORMAT
RETURN VALUE
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 21:24:53 GMT, May 02, 2003