New implementation using Python and "watchdog"

This version collects the events in a separate thread, and doesn't gobble up events. So hopefully it's more robust, in
addition to being easier to read.

One downside of using the "watchdog" module is that it only exposes file/dir modification events. So if I ever want to
keep track of opened files, I'll have to call inotifywait again.
This commit is contained in:
David Coppit
2017-04-01 23:23:05 -04:00
parent d0b25a4ed4
commit 7ed3d92e8b
4 changed files with 297 additions and 248 deletions

View File

@@ -10,7 +10,7 @@ RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup \
RUN set -x \
&& apt-get update \
&& apt-get install -y inotify-tools wget \
&& apt-get install -y python3-watchdog wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@@ -29,11 +29,11 @@ RUN chmod a+rwX /files
ADD sample.conf /files/sample.conf
RUN chmod a+r /files/sample.conf
# Add scripts. Make sure start.sh and monitor.sh are executable by $UID
# Add scripts. Make sure start.sh and monitor.py are executable by $UID
ADD start.sh /files/
RUN chmod a+x /files/start.sh
ADD monitor.sh /files/
RUN chmod a+x /files/monitor.sh
ADD monitor.py /files/
RUN chmod a+x /files/monitor.py
ADD runas.sh /files/
RUN chmod +x /files/runas.sh
ADD mapids.sh /files/