rsync+crontab每分钟同步文件

老子叫甜甜 提交于 2020-10-31 13:33:34

环境:
192.168.172.131服务端
192.168.172.133客户端

服务端:

1 yum -y install rsync
2 mkdir /root/abc
cd /root/abc
touch aaa
3 vim /etc/rsyncd.conf



uid = nobody
gid = nobody
use chroot = yes
address = 192.168.172.131
port 873
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
hosts allow = 192.168.172.0/24
[wwwroot]
path = /root/abc
comment = Document Root of www.51xit.top
read only =no
dont comperss = *.gz *.bz2 *.tgz *.zip *.rar *.z
auth users =backuper
secrets file = /etc/rsyncd_users.db













4 cat /etc/rsyncd_users.db
backuper:pwd123
chmod 600 /etc/rsyncd_users.db
systemctl stop firewalld
5 rsync --daemon
netstat -anpt |grep rsync
tcp 0 0 192.168.172.131:873 0.0.0.0:* LISTEN 12173/rsync





客户端

yum -y install rsync
systemctl stop firewalld
mkdir /root/abc
chmod 777 /root/abc
vi /etc/server.pass
在这里插入图片描述




chmod 600 /etc/server.pass
rsync -az --password-file=/etc/server.pass backuper@192.168.172.131::wwwroot /root/abc
cd abc/
ll
在这里插入图片描述
crontab -e
在这里插入图片描述
到这里就结束了






易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!