全部博文(298)
分类: LINUX
2012-04-25 16:03:47
【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, --access trigger when a file in the directory was accessed
-M, --modify trigger when a file in the directory was modified
-C, --create trigger when a file was created in the directory
-D, --delete trigger whan a file was unlinked from the directory
-R, --rename trigger when a file in the directory was renamed
-B, --attrib trigger when the directory had its attributes
changed (after chmod, chown)
-a, --all all 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=FILE read directories to monitor from FILE, one per line
-p, --processes=COUNT max number of commands to run at a time
-q, --queue=DEPTH max depth of queue holding commands to be run
-t, --times=COUNT exit after running the command COUNT times
-o, --once same as `--times 1'
-r, --recursive monitor subdirectories too (recursively)
-b, --background run in background (detach)
-s, --silent don't print warnings about non-zero child exits
--quiet same as `--silent'
--help display this help and exit
--version output 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