The previous script will log create, move, and delete events in the given path. The -m option causes watch to stay active and monitor changes continuously, rather than exiting after an event happens. The -r option enables a recursive watch of the directories (symbolic links are ignored). The -e option specifies the list of events to be watched and -q reduces the verbose messages and prints only the required ones. This output can be redirected to a log file.
The events that inotifywait can check include the following:
|
Event
|
Description
|
|
access |
When a read happens to a file |
|
modify |
When file contents are modified |
|
attrib |
When metadata is changed |
|
move |
When a file undergoes a move operation |
|
create |
When a new file is created |
|
open |
When a file undergoes an open operation |
|
close |
When a file undergoes a close operation |
|
delete |
When a file is removed |