evhand - Process new events in a textfile, events described per lines



NAME

evhand - Process new events in a textfile, events described per lines


SYNOPSIS

evhand [OPTIONS] EVENT-FILE STATE-FILE HANDLER [ARGS]


DESCRIPTION

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.


OPTIONS

-e, --errexit

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.

-C, --checksum-state

Record and check the event's checksum in STATE-FILE instead of the verbatim event string itself.

--shrink-state

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.


ENVIRONMENT

EVENT

The string representing the event to be handled. This is passed by evhand(1) to the HANDLER programm.


LIMITATIONS

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.


NON-FEATURES

Out-of-scope features for evhand(1) and suggestions what to do instead:

record any output from the event hander

See eg. logto(1), redirexec(1), ...

record the date/time when the event is handled

See eg. ts(1), timestamper(1), ...

automatic retry

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.

watch the event file for new events

Use an inotify(7) frontend, like iwatch(1) to trigger evhand(1).

parallel event processing

Sort events into multiple separate event files and run other evhand(1) sessions on them.


SEE ALSO

uniproc(1)