[host]$ docker run -ti --entrypoint /bin/bash \
--name reduce dockerinpractice/log-cleaner-purged
$ apt-get update && apt-get install -y inotify-tools
$ inotifywait -r -d -o /tmp/inotifywaitout.txt \
/bin /etc /lib /sbin /var
inotifywait[115]: Setting up watches.  Beware: since -r was given, this may take a while!
inotifywait[115]: Watches established.
$ inotifywait -r -d -o /tmp/inotifywaitout.txt /usr/bin /usr/games \
/usr/include /usr/lib /usr/local /usr/sbin /usr/share /usr/src
inotifywait[118]: Setting up watches.  Beware: since -r was given, this may take a while!
inotifywait[118]: Watches established.
$ sleep 5
$ cp /usr/bin/clean_log /tmp/clean_log
$ rm /tmp/clean_log
$ bash
$ echo "Cleaning logs over 0 days old"
$ find /log_dir -ctime "0" -name '*log' -exec rm {} \;
$ awk '{print $1$3}' /tmp/inotifywaitout.txt | sort -u > \
/tmp/inotify.txt
$ comm -2 -3 \
<(find /bin /etc /lib /sbin /var /usr -type f | sort) \
<(cat /tmp/inotify.txt) > /tmp/candidates.txt
$ cat /tmp/candidates.txt | xargs rm
$ exit
$ exit
