新建一个rsync.s文件,把下面的代码写入文件里:

#!/usr/bin/env bash
mkdir -p /data/app/rsync/etc/
mkdir -p /data/logs/rsync/
mkdir -p /data/download/
mkdir -p /data/www/test/
cd /data/download
wget https://download.samba.org/pub/rsync/src/rsync-3.1.3.tar.gz
tar zxvf rsync-3.1.3.tar.gz
cd rsync-3.1.3
./configure --prefix=/data/app/rsync
make && make install echo 'wzb:123456' > /data/app/rsync/etc/rsyncd.secrets
chmod 600 /data/app/rsync/etc/rsyncd.secrets cat > /data/app/rsync/etc/rsyncd.conf <<EOF
max connections = 5
# 基本配置,注意uid和gid需要是root,否则无法指定目标文件的所属用户和所属组
secrets file = /data/app/rsync/etc/rsyncd.secrets
read only = no
write only = no
list= yes
uid = root
gid = root
max connections = 5
hosts allow = *
#hosts deny = *
use chroot = no
log file = /data/logs/rsync/rsyncd.log
pid file = /var/run/rsyncd.pid
# 设置访问的用户必须为rsync,这个用户是虚拟的,不需要在系统中创建这个用户。客户端进行推送的时候指定即可
auth users = wzb
# 设置密码文件位置,这里保存了rsync用户的密码
secrets file = /data/app/rsync/etc/rsyncd.secrets
# 配置一个模块,一个模块就是一个可以进行同步的目录,可以配置多个模块意味着接受多个目录的同步请求,模块名是随意起的,客户端在发起同步时需指定模块名
[test]
path = /data/www/test
# 设置访问的用户必须为rsync,这个用户是虚拟的,不需要在系统中创建这个用户。客户端进行推送的时候指定即可
auth users = wzb
# 设置密码文件位置,这里保存了rsync用户的密码
secrets file = /data/app/rsync/etc/rsyncd.secrets
EOF #添加开机启动
cat > /data/app/rsync/rsync_service.sh <<EOF
#!/bin/bash
/data/app/rsync/bin/rsync --daemon --config=/data/app/rsync/etc/rsyncd.conf
EOF chmod +x /data/app/rsync/rsync_service.sh cat >> /etc/rc.local <<EOF
/data/app/rsync/rsync_service.sh
EOF
if [[ $? == 0 ]]; then
echo -e "\n==========rsync安装成功==========\n\n"
else
echo -e "\n==========rsync安装失败!==========\n\n"
exit 0
fi

客户端上传文件列子:

rsync -avzP --exclude-from=exclude.txt ./ wzb@116.**.1**.**5::test --chown=www:www --progress --password-file=/etc/waptest_tp5.txt
rsync -avzP --exclude-from=exclude.txt ./ wzb@116.**.1**.**5::test --chown=www:www --progress --delete --password-file=/etc/waptest_tp5.txt

#/etc/waptest_tp5.txt  密码文件

#exclude.txt  过滤文件

#--delete 参数为完全同步

下载文件列子:

rsync -avz --exclude-from=exclude.txt wzb@4*.**.**.1*1::test ./ 

liunx 安装rsync的更多相关文章

  1. windows安装rsync

    客户端:cwRsync 4.0.5 Installer 服务端:cwRsyncServer 4.0.5 Installer 安装配置Rsync服务端 1.直接双击安装包安装即可,在安装过程中会有要求用 ...

  2. liunx安装py.27

    liunx安装py.27 按网站(https://blog.csdn.net/u012071918/article/details/78817344) 上的教程安装py.27 1.安装依赖的库 在终端 ...

  3. Liunx 安装 Nessus

    Liunx 安装 Nessus   啥子是Nessus 它是一款系统漏洞扫描与分析软件,可以扫描服务器存在哪些漏洞,页面简介美观,非常Nice. 获取激活码 首先访问如下网站 https://www. ...

  4. window安装rsync客户端和服务端

    原文地址: https://www.cnblogs.com/janas/p/3321087.html 下载地址: https://linux.linuxidc.com/index.php?folder ...

  5. Linux 安装Rsync和配置

    1.检查rsync 是否已经安装 [root@test home]# rpm -qa|grep rsync 若已经安装,则使用rpm -e 命令卸载. [root@test home]#rpm -e ...

  6. linux 下安装rsync

    一.服务器端配置: 1.安装xinetd,并修改rsync相关配置 # yum -y install xinetd # vi /etc/xinetd.d/rsync 如下代码: service rsy ...

  7. liunx 安装 mysql 5.6

    第一步  解压文件 目录切换到/usr/local/ cd /usr/local/ 解压 tar zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz 重命名为 ...

  8. liunx 安装redis 4.0

    liunx 上安装redis 4.0.1 第一步:将 redis-4.0.1.tar.gz 压缩问上传至/home目录下 第二步: 解压文件  tar -zxvf  redis-4.0.1.tar.g ...

  9. 配置rsync 同步数据 rpm包安装rsync及配置

    [root@Hammer home]# rpm -qa |grep rsync #检查系统是否安装了rsync软件包rsync-2.6.8-3.1[root@Hammer CentOS]# rpm - ...

随机推荐

  1. vue中改变数组或对象,页面没做出对应的渲染

    原文链接 数组更新检测 变异方法 Vue 包含一组观察数组的变异方法,所以它们也将会触发视图更新.这些方法如下: push() pop() shift() unshift() splice() sor ...

  2. ERROR: virtualenvwrapper could not find virtualenv in your path

    环境: Ubuntu 18.04 Python3 使用pip3安装virtualenv和virtualenvwrapper两个包,ubuntu18.04中,用户使用pip安装的包在~/.local/下 ...

  3. 微信小程序_(表单组件)button组件的使用

    微信小程序表单组件button官方文档 传送门 Learn 一.button组件的使用 一.button组件的使用 size:按钮的大小[默认值default] type:按钮的样式类型[默认值def ...

  4. [题解] [CQOI2007] 余数求和

    题面 题解 考虑到这个等式\(a\bmod b = a - b * \lfloor\frac{a}{b}\rfloor\) 所以我们可以得到: \[ \begin{aligned} ans & ...

  5. C++入门经典-例7.9-对象数组,批量化生产

    1:在数组内容中我们了解到,数组是通过指针分配到的一段额定大小的内容.同样,数组也可以包含对象.声明对象数组的形式如下: box boxArray[5]; box boxArray2[2]={box( ...

  6. CSS效果——绝对居中

    实现效果 不论窗口尺寸,都可以垂直和水平居中. 代码 <!DOCTYPE html> <html> <head> <meta charset="ut ...

  7. CentOS 安装 Mongodb详解 --- 无Linux基础

    先去官方下载离线安装包:https://www.mongodb.com/ ftp连接一下服务器,把离线包上传上去 XShell连接一下: 解压文件(你输一点就可以按tab键,它会自动补全):tar - ...

  8. Android RecyclerView与ListView比较

    RecyclerView 概述 RecyclerView 集成自 ViewGroup .RecyclerView是Android-support-V7版本中新增的一个Widgets,官方对于它的介绍是 ...

  9. leetcode324 摆动排序II

      1. 首先考虑排序后交替插入 首尾交替插入,这种方法对于有重复数字的数组不可行: class Solution { public: void wiggleSort(vector<int> ...

  10. JAVA多线程程序ProgressBar2

    JAVA多线程程序ProgressBar2 题目简介: 思路分析:与上一篇:JAVA多线程程序ProgressBar类似,本篇避免过于冗杂,所以在此没有给出. 实验代码: import java.aw ...