Skip to content

Instantly share code, notes, and snippets.

@moomindani
Created June 15, 2014 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moomindani/0dce029fef3b8031a567 to your computer and use it in GitHub Desktop.
Save moomindani/0dce029fef3b8031a567 to your computer and use it in GitHub Desktop.
Monitoring directory using inotifywait
#!/bin/sh
/usr/bin/inotifywait -e create,delete,modify,move,attrib \
-mrq /etc | while read line; do
echo $line | tee -a /var/log/dirmon.log
dirmon_count=`cat /tmp/dirmon_count`
echo `expr $dirmon_count + 1` > /tmp/dirmon_count
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment