1月 102014
 

服务器端设置

[root@backup ~]# yum install xinetd rsync

[root@www ~]# cat /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = –daemon
log_on_failure += USERID
}
[root@www ~]#
[root@www ~]# cat /etc/rsyncd.secrets
root:ju7ggtu6nji9
[root@www ~]#

[root@www ~]# chmod 600 /etc/rsyncd.secrets
[root@www ~]# cat /etc/rsyncd.conf
port=873
uid = apache
gid = apache
user chroot = no
max connections = 200
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[backup]
path = /var/www/html
ignore errors
read only = no
list = no
#hosts allow = 192.168.1.0/255.255.255.0
auth users = root
secrets file = /etc/rsyncd.secrets
[root@www ~]#
启动服务
[root@www ~]# rsync –daemon

[root@www ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don’t
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/usr/bin/rsync –daemon
[root@www ~]#

客户端设置
[root@backup ~]# yum install rsync

[root@backup ~]# cat /etc/rsync.passwd
ju7ggtu6nji9
[root@backup ~]#
定时任务
05 2 * * * root rsync -avz –progress –password-file=/etc/rsync.passwd root@152.101.1.2::backup /var/www/html/
端口TCP873