【发布时间】:2016-12-09 08:40:27
【问题描述】:
我在 CentOS 7 上使用 inotify-tools 在每次 ftp 上传时执行一个 php 脚本。
它工作正常,但有一个问题;当上传中止时(例如,如果我停止上传或关闭 FTP 客户端),它仍然会触发脚本。
这样可以避免这些情况吗?
我的代码:
#!/bin/sh
MONITORDIR="/path/to/some/dir"
inotifywait -m -r -e close_write --format '%w%f' "${MONITORDIR}" | while read NEWFILE
do
php /path/to/myscript.php ${NEWFILE}
done
【问题讨论】:
标签: linux ftp inotifywait inotify-tools