Skip to content

Instantly share code, notes, and snippets.

@ScalaWilliam
Created June 26, 2017 00:31
Show Gist options
  • Save ScalaWilliam/2d9704591d5303c391b9aacaf94a56d5 to your computer and use it in GitHub Desktop.
Save ScalaWilliam/2d9704591d5303c391b9aacaf94a56d5 to your computer and use it in GitHub Desktop.
Watching for changes for a specific file in Linux
inotifywait -m -e close_write,moved_to,create . |
while read -r directory events filename; do
if [ "$events" = "CLOSE_WRITE,CLOSE" ]; then
if [ "$filename" = "users.db.txt" ]; then
echo "K"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment