Created
June 26, 2017 00:31
-
-
Save ScalaWilliam/2d9704591d5303c391b9aacaf94a56d5 to your computer and use it in GitHub Desktop.
Watching for changes for a specific file in Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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