【dnotify】Linux的文件夹监控
Ubuntu下面监控文件夹可以使用命令dnotify
安装:apt-get install dnotify
Usage:
dnotify [OPTION]… DIRECTORY… [-e COMMAND…]
Execute
a command every time the contents of a directory change.
Events:
-A, –accesstrigger when a file in the directory
was accessed
-M, –modifytrigger when a file in the
directory was modified
-C, –createtrigger when a file was created in
the directory
-D, –deletetrigger whan a file was unlinked
from the directory
-R, –renametrigger when a file in the
directory was renamed
-B, –attribtrigger when the directory had its
attributes
changed (after
chmod, chown)
-a, –allall of the above
General:
-e, –execute=COMMAND..command to execute when an event is triggered
(all remaining args
are treated as command args)
-f, –file=FILEread directories to monitor from
FILE, one per line
-p, –processes=COUNTmax number of commands to run at a time
-q, –queue=DEPTHmax depth of queue holding commands to
be run
-t, –times=COUNTexit after running the command COUNT
times
-o, –oncesame as `–times 1′
-r, –recursivemonitor subdirectories too
(recursively)
-b, –backgroundrun in background (detach)
-s, –silentdon’t print warnings about
non-zero child exits
–quietsame as `–silent’
–helpdisplay this help and exit
–versionoutput version information and exit
Unless
events have been specified, the events are set to create and delete.
Specifying
-1 for queue means unlimited depth. The default value for –queue
is
-1, and 1 for –processes.
The
default command (unless specified with -e) is to print the name of the
of
the directory updated. The string `{}’ in the command specification is
replaced
by the name of the directory that was updated.
Report
bugs to .