ubuntu系统自带rsync,首先配置/etc/default/rsync,启用daemon模式

修改/etc/rsyncd.conf配置文件

cat /etc/rsyncd.conf
# sample rsyncd.conf configuration file # GLOBAL OPTIONS #motd file=/etc/motd
log file=/var/log/rsyncd
# for pid file, do not use /var/run/rsync.pid if
# you are going to run rsync out of the init.d script.
# The init.d script does its own pid file handling,
# so omit the "pid file" line completely in that case.
pid file=/var/run/rsyncd.pid
syslog facility=daemon
#socket options= # MODULE OPTIONS [image_ftp] comment = public archive#comment名称自定义
path = /var/www/html#需要同步的目录
use chroot = no
# max connections=10
lock file = /var/lock/rsyncd
# the default for read only is yes...
read only = yes
list = yes
uid = root
gid = root
# exclude =
# exclude from =
# include =
# include from =
auth users = root #该用户需和客户端拉取用户保持一致,这里以root为例
secrets file = /etc/rsyncd.secrets #用户密码文件
strict modes = yes
hosts allow = 192.168.1.100 #允许拉取的客户端ip
# hosts deny =
ignore errors = yes
ignore nonreadable = yes
transfer logging = yes
log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
timeout = 600
refuse options = checksum dry-run
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

创建存放用户名和密码的文件

vim /etc/rsyncd.secrets

启动rsync服务

/etc/init.d/rsync start

赋予600权限

chmod 600 /etc/rsyncd.secrets

查询服务是否启动,注意防火墙需要开放873端口

在客户端上执行拉取命令,nohup+& 让服务保持在后台运行,防止中断

nohup rsync -avuz -e 'ssh -p 2222' root@192.168.1.100:/var/www/html /data &
nohup rsync -avuz -e 'ssh -p 2222' root@192.168.1.100:/var/www/html /data
ctrl + z 挂起
bg 将进程置于后台运行
jobs 查询后台运行任务

  

Ubuntu 14.04.2配置rsync的更多相关文章

  1. Ubuntu 14.04 x64配置Android 4.4 kitkat编译环境的方法

    Ubuntu 14.04 x64配置Android 4.4 kitkat编译环境的方法跟Ubuntu 12.04 - 13.10 以及jellybean编译环境配置没多大区别, 顺便记录下而已: Ub ...

  2. Ubuntu 14.04 虚拟机配置固定ip地址

    Ubuntu 14.04 虚拟机配置固定ip地址: 虚拟机用的NAT方式配置: 1.虚拟机: 虚拟机→设置→网络适配器→NAT模式: 2.虚拟机:编辑→虚拟网络编辑器→更改设置→选择NAT→填入子网I ...

  3. 在 Ubuntu 14.04 中配置 PXE 服务器

    PXE(预启动执行环境Preboot Execution Environment)服务器允许用户从网络中启动 Linux 发行版并且可以不需要 Linux ISO 镜像就能同时在数百台 PC 中安装. ...

  4. 如何在 Ubuntu 14.04 里面配置 chroot 环境

    你可能会有很多理由想要把一个应用.一个用户或者一个环境与你的 Linux 系统隔离开来.不同的操作系统有不同的实现方式,而在 Linux 中,一个典型的方式就是 chroot 环境. 在这份教程中,我 ...

  5. Ubuntu 14.04—Eclipse配置Pydev

    Eclipse: 1. 下载 Eclipse 最新版 访问官方网站下载 Eclipse 最新版,这个就不多说了,大家自己去下.  http://www.eclipse.org/downloads/?o ...

  6. Ubuntu 14.04 安装配置备忘录

    完全在 Linux 下工作,大概有3年时间了. 之前都是用 Windows, 而把 Linux 装在虚拟机里,现在反过来,把 Windows 装在了虚拟机里,只是因为偶尔还要用网银的缘故. 以我这几年 ...

  7. Ubuntu 14.04.1 配置 Android 源码开发环境(jdk版本切换)(转载)

    转自:http://www.cnblogs.com/ren-gh/p/4248407.html # Ubuntu 14.04.1 1.更新源: sudo apt-get update 安装vim工具: ...

  8. Ubuntu 14.04安装配置NFS服务器

    (一)安装NFS服务器1.1-安装Ubuntu nfs服务器端: sudo apt-get install nfs-kernel-server 1.2-安装nfs的客户端: sudo apt-get ...

  9. Ubuntu 14.04 dnw配置

    之前写的Ubuntu嵌入式环境搭建没有讲怎么配置dnw下载工具,使用dnw还得用红帽,今天配置好了ubuntu下的dnw,记录一下 首先先下载dnw的源码,这是我上传的提供给大家下载:http://p ...

随机推荐

  1. [转] 浅谈 OpenResty

    一.前言 我们都知道Nginx有很多的特性和好处,但是在Nginx上开发成了一个难题,Nginx模块需要用C开发,而且必须符合一系列复杂的规则,最重要的用C开发模块必须要熟悉Nginx的源代码,使得开 ...

  2. Referenced file contains errors (http://www.springframework.org/...解决

    今天打开老项目出现如下错误: Referenced file contains errors (http://www.springframework.org/schema/context/spring ...

  3. sizeof运算符和strlen()函数

    首先放上代码和运行结果.(在VC6.0上运行) #include<stdio.h> #include<string.h> int main(void) { char s1[]= ...

  4. python_封装redis_hash方法

    xshell 进入 虚拟环境 安装 redis workon py3env # 进入虚拟环境 pip install redis # 安装redis deactivate # 退出虚拟环境 简单的封装 ...

  5. Codeforces Round #499 (Div. 1) F. Tree

    Codeforces Round #499 (Div. 1) F. Tree 题目链接 \(\rm CodeForces\):https://codeforces.com/contest/1010/p ...

  6. mongodb常规操作语句

    db.c_user.insertOne({ name: "ljm", pwd: "123456" }); //插入一个 db.c_user.insertMany ...

  7. string.Compare()方法

    判断字符串中是否包含一个值 返回一个值,该值指示指定的 String 对象是否出现在此字符串中. String a = "abcd"; if(source.a("a&qu ...

  8. :阿里巴巴 Java 开发手册 (十一)工程结构

    (一) 应用分层 1. [推荐]图中默认上层依赖于下层,箭头关系表示可直接依赖,如:开放接口层可以依赖于 Web 层,也可以直接依赖于 Service 层,依此类推:  开放接口层:可直接封装 Se ...

  9. git reset --hard HEAD^后显示more?的原因及如何解决

    在windows的cmd控制台下操作git,想要回滚到上一次提交,但是输入git reset --hard HEAD^后就显示more? fatal: ambiguous argument 'HEAD ...

  10. iOS 12中获取WiFi的SSID

    开始搞智能家居,wifi获取不到了?? 小插曲 旧方法失效,19-12-15更新,ios13开始需要请求定位信息 SSID全称Service Set IDentifier, 即Wifi网络的公开名称. ...