rsync实例记录

服务端

  • rsync --daemon --config=/etc/rsyncd.conf #启动命令
  • 配置文件 /etc/rsyncd.conf
# Distributed under the terms of the GNU General Public License v2
# Minimal configuration file for rsync daemon
# # See rsync(1) and rsyncd.conf(5) man pages for help

# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
port = 873
address = 10.162.81.59
#uid = nobody 
#gid = nobody    
uid = root
gid = root

use chroot = yes
read only = false

#limit access to private LANs
hosts allow=10.111.177.219,10.111.214.166
#hosts deny=*

max connections = 5
motd file = /etc/rsyncd.d/rsyncd.motd
#This will give you a separate log file
log file = /var/log/rsync.log

#This will log every file transferred - up to 85,000+ per user, per sync
#transfer logging = yes

log format = %t %a %m %f %b
syslog facility = local3
timeout = 300


[www]
uid = wwww
gid = daemon
path = /webdata/trust.myweb.com
list=yes
ignore errors
comment = This is www
auth users = web_backup
secrets file = /etc/rsyncd.d/rsyncd_back.pwd



[server]
uid = wwww
gid = daemon
path = /webdata/trustserver_myweb_com/public_html
#path = /webdata/test/public_html
list=yes
ignore errors
comment = This is server
auth users = web_backup
secrets file = /etc/rsyncd.d/rsyncd_back.pwd


[mobile]
uid = wwww
gid = daemon
path = /webdata/m.myweb.com
list=yes
ignore errors
comment = This is server
auth users = web_backup
secrets file = /etc/rsyncd.d/rsyncd_back.pwd

[channel]
uid = wwww
gid = daemon
path = /webdata/channel.myweb.com
list=yes
ignore errors
comment = This is server
auth users = web_backup
secrets file = /etc/rsyncd.d/rsyncd_back.pwd
  • /etc/rsyncd.d/rsyncd_back.pwd文件
web_backup:##123.123.456JJKe3326ttdd
  • /etc/rsyncd.d/rsyncd.motd 文件
this is anyidai rsync_server
=================================================

客户端

  • /etc/crontab 中配置文件
00  04 * * * root  /usr/bin/rsync -auv   --password-file=/root/nodel/r.pass  /data/www/trust.myweb.com/   [email protected]::www  &>>/var/log/rsync_clent.log
30  04 * * * root  /usr/bin/rsync -auv   --password-file=/root/nodel/r.pass  /data/www/m.myweb.com/   [email protected]::mobile  &>>/var/log/rsync_clent.log
40  04 * * * root /usr/bin/rsync -auv   --password-file=/root/nodel/r.pass  /data/www/channel.myweb.com/   [email protected]::channel &>>/var/log/rsync_clent.log
  • /root/nodel/r.pass文件
##123.123.456JJKe3326ttdd

你可能感兴趣的:(rsync实例记录)