监控文件可使用 inotifywait
2017-04-27 本文已影响17人
9682f4e55d71
#!/bin/bash
dir="${1}"
inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%w%f' --event CLOSE_WRITE,delete --exclude '.svn' $dir | while read file
do
if [ "${file: -4}" != '4913' ] && [ "${file: -1}" != '~' ]; then
php /sync.php $file
fi
done