- 论坛徽章:
- 0
|
aaa目录如果有文件变化则同步增加到ccc目录
bbb目录如果有文件变化则同步增加到ccc目录
ccc目录整个同步到另一台服务器上
单独运行rsync的三条命令 是正常的
将脚本在后台运行后 只有aaa目录同步增加到ccc目录是正常的 其余两个不正常 怀疑是while done语句不对 请大神指点
#!/bin/bash
/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e close_write,delete,create,attrib /data/aaa | while read files
do
/usr/bin/rsync -vzrtopgu /data/aaa /data/ccc >/dev/null 2>&1
echo "${files} was rsynced" >> /var/log/rsync.log 2>&1
done
/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e close_write,delete,create,attrib /data/bbb | while read files
do
/usr/bin/rsync -vzrtopgu /data/bbb/ /data/ccc/ >/dev/null 2>&1
echo "${files} was rsynced" >> /var/log/rsync.log 2>&1
done
/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e close_write,delete,create,attrib /data/ccc | while read files
do
/usr/bin/rsync -vzrt --delete --port=5873 --password-file=/etc/rsync.pas /data/ccc rsyncuser@11.11.11.11::image
echo "${files} was rsynced" >> /var/log/rsync.log 2>&1
done
|
|