【发布时间】:2015-02-26 03:33:46
【问题描述】:
初始化源目录和目标目录。
srcdir=/user/user1/src
tagtdir=/user/user1/dest
我希望在将文件复制到 srcdir 和 -m 以进行持续监控时收到通知。
inotifywait -m -r -e close "$srcdir" |
while read filename eventlist eventfile
调用我的 python 脚本。
do
mv "$srcdir/$eventfile" "$tgtdir/$eventfile" && ./myscript.py "$eventfile"
done
不幸的是,我的脚本很长一段时间,如果在执行myscript.py 时还有其他文件被复制,我会错过这些事件。是否可以将事件排队并稍后处理?
另一个选项是我将在后台运行myscript.py,这可能会解决这个问题。
【问题讨论】:
标签: inotify inotifywait inotify-tools