update readme from manpage
[forkaftergrep.git] / fag.1
CommitLineData
7966a08a 1.TH fag 1 "13 October 2017" "1.1" "User Commands"
4f83e12d 2.hy 0
3.SH NAME
7966a08a 4fag \- daemonize program after a regular expression pattern was matched (ForkAfterGrep)
4f83e12d 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
b98f2a91 69if grep gets killed (e.g. `killall grep'), fag should terminate.
4f83e12d 70.SS Reporting Bugs
71Please report bugs and patches to the issue tracker at https://github.com/girst/forkaftergrep/.
72.SH NOTES
de1e8d30 73.IR SIGNAL
74needs to be given as an integer. implementing mnemonics is dirty and not very portable; maybe support in the future.
7966a08a 75.PP
76Since 1.1, if
77.B fag
78gets interrupted or terminated,
79.BR SIGTERM
80is sent to
81.IR PROGRAM.
4f83e12d 82.SH COPYRIGHT
83Copyright 2017 Tobias Girstmair. This is free software; see https://www.gnu.org/licenses/gpl-3.0.html for conditions.
84.SH AUTHOR
7966a08a 85Tobias Girstmair (https://gir.st)
Imprint / Impressum