| evhand - Process new events in a textfile, events described per lines |
evhand - Process new events in a textfile, events described per lines
evhand [OPTIONS] EVENT-FILE STATE-FILE HANDLER [ARGS]
evhand(1) iterates through EVENT-FILE and run HANDLER command on each new lines.
What is considered new is decided by STATE-FILE.
Handled events are recorded in STATE-FILE (either by verbatim or by checksum),
so new events are those not in the state file.
If HANDLER command fails, the event is not considered to have been handled.
Exit at the first failed HANDLER command. Exit status will be the failed handler command's exit status if terminated normally, and 128 + signal number if killed by a signal. By default, run HANDLER for all events, and exit with zero regardless of handler commands exit status.
Record and check the event's checksum in STATE-FILE instead of the verbatim event string itself.
Remove those entries from the state file which are not encountered in the event file. Shrinks only when the whole event file could be read up, so not if interrupted by a failed handler command (in --errexit mode) nor if any other error prevented to learn all the events in the event file.
This is useful if you regularly purge old events from the event file and don't want the state file to grow indefinitely.
The string representing the event to be handled.
This is passed by evhand(1) to the HANDLER programm.
EVENT should not contain NUL byte as it can not be put in the environment.
stdin(3) is closed for the HANDLER process.
STATE-FILE is locked during the event handling process, so only 1 process can handle events per each STATE-FILE.
Out-of-scope features for evhand(1) and suggestions what to do instead:
See eg. logto(1), redirexec(1), ...
See eg. ts(1), timestamper(1), ...
Just re-run evhand(1).
Or wrap it by repeat(1) like:
env REPEAT_UNTIL=0 repeat evhand -e ...
It restarts evhand until its exit status is zero. Assumed that the failure is temporary.
Use an inotify(7) frontend, like iwatch(1) to trigger evhand(1).
Sort events into multiple separate event files and run other evhand(1) sessions on them.
uniproc(1)