I'm using inotify-tools on CentOS 7 to execute a php script on every ftp upload.
It's working fine, but there is one problem; when the upload gets aborted (for example if I stop uploading or close FTP client) then it still triggers the script.
Is this possible to avoid those situations?
My code:
#!/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