s6
Software
skarnet.org
The s6-ftrig-listen program
s6-ftrig-listen subscribes to several fifodirs, then
spawns a program, then waits for pattern of events to occur on the fifodirs.
Interface
In an execlineb
script:
s6-ftrig-listen [ -a | -o ] [ -t timeout ] { fifodir1 regexp1 fifodir2 regexp2 ... } prog...
- s6-ftrig-listen subscribes to fifodir1 with the regexp regexp1,
to fifodir2 with the regexp regexp2, and so on.
- It then forks and exec prog... with all its arguments
- It waits for the series of events received on fifodir-i
to match regexp-i, The regexp-i must be
Extended
Regular Expressions.
- When the series of read events matches the regexps,
s6-ftrig-listen exits 0.
Options
- -t timeout : if the events on the fifodirs have not
matched the regexps after timeout milliseconds, print an error message on
stderr and exit 1. By default, s6-ftrig-listen waits indefinitely for a matching series
of events.
- -a : and (conjunction). s6-ftrig-listen will only exit when all
the fifodir-i have been notified with events matching the corresponding regexp-i.
This is the default.
- -o : one (disjunction). s6-ftrig-listen will exit as soon as one
of the fifodir-i has been notified with events matching its regexp-i.
Notes
s6-ftrig-listen can be used outside of an execlineb script by using the
internal argv syntax, but this syntax is an implementation detail and is
not documented as stable. In a shell
script, use execlineb -Pc 's6-ftrig-listen ...' to get the
benefits of the execlineb brace syntax.