rsync+crontab synchronizes files every minute

Environment:
192.168.172.131 server
192.168.172.133 client

Server:

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

Client

yum -y install rsync
systemctl stop firewalld
mkdir /root/abc
chmod 777 /root/abc
vi /etc/server.pass
Insert picture description here

chmod 600 /etc/server.pass
rsync -az --password-file=/etc/server.pass [email protected]::wwwroot /root/abc
cd abc/
ll
Insert picture description here
crontab -e
Insert picture description here
This is the end

Guess you like

Origin blog.csdn.net/weixin_50663202/article/details/109355469