分类: 系统运维
2015-08-16 12:33:30
[root@super63 ~]# vim /etc/rsyncd.cof
uid=nobody
gid=nobody
address = 192.168.1.63
port=873
hosts allow= 192.168.1.64
#hosts deny=0.0.0.0/32
use chroot=yes
max connections=5
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsync.lock
log file=/var/log/rsyncd.log
motd file=/etc/rsyncd.motd
[wwwroot]
path=/var/www/html
comment=rsync wwwroot of
read only=yes
list=yes
auth users=backuper
secrets file=/etc/rsync.passwd
[root@super63 ~]# echo "welcome to
backup server" > /etc/rsyncd.motd
[root@super63 ~]# vim /etc/rsync.passwd
backuper:123456
[root@super63 ~]# chmod 600
/etc/rsync.passwd
开启rsync:
[root@super63 ~]# vim /etc/xinetd.d/rsync
创建配置文件中所需要的文件:
disable = no
开启服务:
[root@super64~]# vim backup.sh
#!/bin/bash
export RSYNC_PASSWORD=123456
rsync -avz backuper@192.168.1.63::wwwroot
/web-back/
[root@super64 ~]# chmod +x backup.sh
[root@super64 ~]# crontab -e
01 3 * * * /root/backup.sh&
[root@super63 ~]# /etc/init.d/xinetd start
客户端配置:
编辑备份脚本:
加入计划任务: