-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathREADME
More file actions
17 lines (12 loc) · 709 Bytes
/
README
File metadata and controls
17 lines (12 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
NOTE: see https://github.com/manos/varnish-statsd-graphite-logger for a more evolved example
of the inotify stuff. (TODO: update this to fully emulate GNU tail)
This script emulates tail -F (follows log files that have been moved, then
created again, a la logrotate), as an example of how to use pyinotify.
Note the strangeness in that you can't watch an individual file with
IN_MOVED_SELF -- pyinotify will error with "file moved and we can't
track it, and therefore can't trust it.. track the directory instead."
Therefore, we track the directory and parse the IN_MODIFY path to verify
the event relates to our specific file.
USAGE:
(pip install pyinotify)
./tail-F_inotify.py /path/to/file [--debug]