rsync拉取模式同步文件

简介:rsync客户端拉取服务端的rsyncd配置文件进行同步,服务端的文件提供只读权限。
服务端安装rsync,使用/etc/rsyncd.conf配置文件

# /etc/rsyncd: configuration file for rsync daemon mode

# See rsyncd.conf man page for more options.

# configuration example:

uid = nobody
gid = nobody
use chroot = yes
max connections = 100

port 873
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.log
hosts allow = *

[chunk]
path = /var/public/file/chunk
comment = chunk ,rsyncd demo test!!!     
read only = no 
list = no 
ignore errors
transfer logging = no          
auth users = abc             
secrets file = /etc/rsyncd_users.db

PS:chunk是配置文件的块,abc是认证用户,rsyncd_users.db是保存认证用户和密码,都是可以自定义,

文件权限必须改为600
cat /etc/rsyncd_users.db
chmod 600 /etc/rsyncd_users.db
systemctl rstart rsyncd

abc:123456

ok,到此处,服务端的rsyncd已经配置完毕。

rsync客户端

crontab -l
*/1 * * * * /root/shell/rsync.sh > /dev/null 2>&1

cat /root/shell/rsync.sh

#!/bin/bash
#author:chunk
#date:20171010

pwd='123456'

/usr/bin/expect<

你可能感兴趣的:(rsync拉取模式同步文件)