Chinaunix首页 | 论坛 | 博客
  • 博客访问: 61001
  • 博文数量: 38
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 396
  • 用 户 组: 普通用户
  • 注册时间: 2015-07-12 14:46
文章分类

全部博文(38)

文章存档

2016年(11)

2015年(27)

我的朋友
最近访客

分类: 系统运维

2015-08-16 12:33:30

rsync是xinetd下的一个子服务。

配置服务端:

创建rsync的配置文件:

[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@super63 ~]# /etc/init.d/xinetd start

客户端配置

编辑备份脚本:

[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&



阅读(449) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~