Add a tail_until_writer_finished script.

This is useful for tailing Apache logs in a rigorous way. We don't want
to use 'tail -f' because it never terminates, even if the writer closes
the file. However, we can't just repeatedly reopen and read the file
without risking losing messages during log rotation. This script uses
inotify to detect when a writer to the tailed file closes the file.

BUG=chromium:621745
TEST=unit tests

Change-Id: I5b060b38e8c3ec316ff6f467b317f895cbf5c394
Reviewed-on: https://chromium-review.googlesource.com/357953
Commit-Ready: Paul Hobbs <phobbs@google.com>
Tested-by: Paul Hobbs <phobbs@google.com>
Reviewed-by: Dan Shi <dshi@google.com>
2 files changed