remove unnecessary close()s, found bug (exit 141)
[forkaftergrep.git] / fag.1
CommitLineData
629b060c 1.TH fag 1 "28 July 2017" "1.0" "User Commands"
4f83e12d 2.hy 0
3.SH NAME
4fag \- daemonize program after a string was found (ForkAfterGrep)
5.
6.SH SYNOPSIS
7.B fag
8.RI [ OPTIONS ]
9.I PATTERN
10.I PROGRAM
11.RI [ ARGUMENTS .\|.\|.]
12.br
13.SH DESCRIPTION
14.B fag
629b060c 15uses
16.B grep
17to search the output of
4f83e12d 18.IR PROGRAM
629b060c 19for the regular expression
20.IR PATTERN
21and daemonizes it when a match is found. The PID is then returned on stdout.
4f83e12d 22.SH OPTIONS
23.SS "Behaviour Changing Options"
24.TP
25.BI \-t " SECONDS" "\fR
26Set a timeout of
27.I SECONDS
28seconds.
29.TP
30.BR \-k " [" \fISIGNAL\fP "]
31If given, send a signal to
32.IR PROGRAM .
33.I SIGNAL
34defaults to
35.BR SIGTERM " (15)."
36Right now, only decimal notation is implemented.
37.TP
38.BR \-e
39Search
40.IR PATTERN
41on
42.BR stderr
43instead of
44.BR stdout .
9949154c 45.TP
46.BR \-V
47Be verbose; print program's
48.BR stdout
49(or stderr if
50.BR \-e
51is set) to stderr.
4f83e12d 52.SS "Generic Program Information"
53.TP
54.B \-h
55Output a short usage message and exit.
56.TP
57.BR \-v
58Display version and copyright information and exit.
59.SH EXIT STATUS
60If
61.IR PATTERN
62was found, 0 is returned. Otherwise, the exit status follows the BSD guideline outlined in
63.B #include <sysexits.h>
64if the error occured from within
65.B fag
66or in case the chid process exits prematurely, its exit code is inherited. Notably, \fI69\fP is returned when the timeout is reached.
4f83e12d 67.SH BUGS
68.SS Known Bugs
4f83e12d 69.IR SIGNAL
70needs to be given as an integer; mnemonic should be supported in the future.
71.PP
05257d9b 72if grep exits with a code > 0, fag should terminate with grep's exit code and an error message. instead, fag exits as if a match was found.
73.PP
4f83e12d 74Sometimes, stdin behaves strange after the program terminates.
75.SS Reporting Bugs
76Please report bugs and patches to the issue tracker at https://github.com/girst/forkaftergrep/.
77.SH NOTES
78Some might find the name of this program offensive. Feel free to create a symlink or alias on your system.
79.SH COPYRIGHT
80Copyright 2017 Tobias Girstmair. This is free software; see https://www.gnu.org/licenses/gpl-3.0.html for conditions.
81.SH AUTHOR
82Tobias Girstmair (http://isticktoit.net)
Imprint / Impressum