in program help text
[forkaftergrep.git] / README.md
CommitLineData
4f83e12d 1# `fag` (Fork After Grep)
2
3```
4fag(1) User Commands fag(1)
5
6NAME
7 fag - daemonize program after a string was found (ForkAfterGrep)
8
9SYNOPSIS
10 fag [OPTIONS] PATTERN PROGRAM [ARGUMENTS...]
11
12DESCRIPTION
ddfcc26d 13 fag uses grep to search the output of PROGRAM for the regular
14 expression PATTERN and daemonizes it when a match is found. The PID is
15 then returned on stdout.
4f83e12d 16
17OPTIONS
18 Behaviour Changing Options
19 -t SECONDS
20 Set a timeout of SECONDS seconds.
21
22 -k [SIGNAL]
23 If given, send a signal to PROGRAM. SIGNAL defaults to SIGTERM
24 (15). Right now, only decimal notation is implemented.
25
26 -e Search PATTERN on stderr instead of stdout.
27
ddfcc26d 28 -V Be verbose; print program's stdout (or stderr if -e is set) to
29 stderr.
30
4f83e12d 31 Generic Program Information
32 -h Output a short usage message and exit.
33
34 -v Display version and copyright information and exit.
35
36EXIT STATUS
37 If PATTERN was found, 0 is returned. Otherwise, the exit status follows
ddfcc26d 38 the BSD guideline outlined in #include <sysexits.h> if the error
39 occured from within fag or in case the chid process exits prematurely,
4f83e12d 40 its exit code is inherited. Notably, 69 is returned when the timeout is
41 reached.
42
43BUGS
44 Known Bugs
4f83e12d 45 SIGNAL needs to be given as an integer; mnemonic should be supported in
46 the future.
47
48 Sometimes, stdin behaves strange after the program terminates.
49
50 Reporting Bugs
51 Please report bugs and patches to the issue tracker at
52 https://github.com/girst/forkaftergrep/.
53
54NOTES
55 Some might find the name of this program offensive. Feel free to create
56 a symlink or alias on your system.
57
58COPYRIGHT
ddfcc26d 59 Copyright 2017 Tobias Girstmair. This is free software; see
4f83e12d 60 https://www.gnu.org/licenses/gpl-3.0.html for conditions.
61
62AUTHOR
63 Tobias Girstmair (http://isticktoit.net)
64
ddfcc26d 651.0 28 July 2017 fag(1)
4f83e12d 66```
3c8bd809 67
68## Notes
69
70I've written this program for the [`tzap`/`szap`](https://linuxtv.org/wiki/index.php/Zap) utilities. They take a few seconds until the TV card/stick is tuned, and won't fork off when they are ready (If you terminate them, the tuning will end). Instead of waiting a few seconds, and hoping for the best, this does the exactly right thing.
Imprint / Impressum