rsync+inotifywait

#!/bin/bash

Path=/data

/usr/bin/inotifywait -mrq --format '%w%f' -e create,close_write,delete /data | while read line
do
        if [ -f $line ];then
                rsync -azP $line --delete rsync_nfs@192.168.200.129::nfs --password-file=/etc/rsync.password
        else
                cd $Path
                rsync -azP ./ --delete rsync_nfs@192.168.200.129::nfs --password-file=/etc/rsync.password
fi
done

原文地址:https://www.cnblogs.com/Mrwangyang/p/9997957.html