1,主机接收数据
uid = root gid = rootuse chroot = yes max connections = 10 pid file = /var/run/rsyncd.pid lock file = /var/run/rsyncd.lock log file = /var/log/rsyncd.log
[tuijian] path = /data/static/tuijian ignore erros read only = false list = false hosts allow = 192.168.0.0/24 hosts deny = 0.0.0.0/32 auth users = rsync secrets file = /etc/rsyncd.pwd
这里需要注意 uid和gid对 path 要有读写权限才行, 把/usr/bin/rsync --daemon 添加到开机启动
2,客户机发送发送数据
rsync -vrtL --progress /data/static/tuijian/* rsync@192.168.0.119::tuijian --password-file=/root/rsync.pwd rsync -vrtL --progress /data/static/tuijian/* rsync@192.168.0.55::tuijian --password-file=/root/rsync.pwd
客户机添加定时任务 */10 * * * * /root/rsync.sh 即可