爱分享

rsync安装与使用

rsync.jpeg

#在centos系统下安装较为简单,只需要一步就好,命令如下

yum install rsync

#配置文件

vi /etc/rsyncd.conf

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


# See rsyncd.conf man page for more options.


# configuration example:


uid = root  #帐号可按实际需求配置

gid = root  #帐号可按实际需求配置

use chroot = no

max connections = 200

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsyncd.lock

log file = /var/log/rsyncd.log

#ignore errors

#auth users = 11rsyncbk

#secrets file = /etc/rsync.password

exclude = lost+found/

transfer logging = yes

timeout = 900

ignore nonreadable = yes

read only = no

write only = no

list = yes

hosts allow= 172.17.28.29

hosts deny=*

# dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

#

[ccydhz]

path = /data/www/ccydhz_official/

comment = "/data/www/ccydhz_official/"

#客户端配置

#!/bin/bash

SRCDIR=/data/www/files/

IP=172.1.2.76 #配置IP地址

DESTDIR=ccydhz

/usr/bin/rsync -az --delete $SRCDIR rsync://$IP/$DESTDIR

nyx
nyx
这个人很神秘