]>
Commit | Line | Data |
---|---|---|
1 | # `fag` (Fork After Grep) | |
2 | ||
3 | ``` | |
4 | fag(1) User Commands fag(1) | |
5 | ||
6 | NAME | |
7 | fag - daemonize program after a string was found (ForkAfterGrep) | |
8 | ||
9 | SYNOPSIS | |
10 | fag [OPTIONS] PATTERN PROGRAM [ARGUMENTS...] | |
11 | ||
12 | DESCRIPTION | |
13 | fag searches the PROGRAM for the string PATTERN. This is useful if a | |
14 | program takes a while to initialize and prints a message to stdout or | |
15 | stderr when ready. When placed in a script, fag blocks execution until | |
16 | the pattern was found, then daemonizes the child process, returns the | |
17 | PID on stdout and exits. | |
18 | ||
19 | OPTIONS | |
20 | Behaviour Changing Options | |
21 | -t SECONDS | |
22 | Set a timeout of SECONDS seconds. | |
23 | ||
24 | -k [SIGNAL] | |
25 | If given, send a signal to PROGRAM. SIGNAL defaults to SIGTERM | |
26 | (15). Right now, only decimal notation is implemented. | |
27 | ||
28 | -e Search PATTERN on stderr instead of stdout. | |
29 | ||
30 | Generic Program Information | |
31 | -h Output a short usage message and exit. | |
32 | ||
33 | -v Display version and copyright information and exit. | |
34 | ||
35 | EXIT STATUS | |
36 | If PATTERN was found, 0 is returned. Otherwise, the exit status follows | |
37 | the BSD guideline outlined in #include <sysexits.h> if the error | |
38 | occured from within fag or in case the chid process exits prematurely, | |
39 | its exit code is inherited. Notably, 69 is returned when the timeout is | |
40 | reached. | |
41 | ||
42 | BUGS | |
43 | Known Bugs | |
44 | Only a simple string search is performed on PATTERN in this version. | |
45 | ||
46 | If a PROGRAM like cat opens stdout/stderr, but never writes to it, the | |
47 | timeout isn't triggered. | |
48 | ||
49 | SIGNAL needs to be given as an integer; mnemonic should be supported in | |
50 | the future. | |
51 | ||
52 | Sometimes, stdin behaves strange after the program terminates. | |
53 | ||
54 | Reporting Bugs | |
55 | Please report bugs and patches to the issue tracker at | |
56 | https://github.com/girst/forkaftergrep/. | |
57 | ||
58 | NOTES | |
59 | Some might find the name of this program offensive. Feel free to create | |
60 | a symlink or alias on your system. | |
61 | ||
62 | COPYRIGHT | |
63 | Copyright 2017 Tobias Girstmair. This is free software; see | |
64 | https://www.gnu.org/licenses/gpl-3.0.html for conditions. | |
65 | ||
66 | AUTHOR | |
67 | Tobias Girstmair (http://isticktoit.net) | |
68 | ||
69 | 1.0 07 February 2017 fag(1) | |
70 | ``` |