新建一个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. HTML5属性备忘单

    在网上闲逛的时候看到了文章,感觉总结的这个html5文章,决定转载过来,在排版的时候也帮助自己重新梳理复习一遍.毕竟学习基础最重要. by zhangxinxu from http://www.zha ...

  2. Java并发编程的艺术笔记(十)——Semaphore详解

    作用:控制同时访问某个特定资源的线程数量,用在流量控制.

  3. phpStrom破解 + Your license has expired

    找到 C:\Windows\System32\drivers\etc 的 hosts文件在最后加上"0.0.0.0 account.jetbrains.com" 然后点击获取注册码 ...

  4. python - linux下 no module named pip

    有网络的情况下,linux系统提示无法使用pip命令: 有两种解决方式: 第一种: =============================== 敲命令:python -m ensurepip 得到 ...

  5. 利用Viewpager和Fragment实现UI框架的搭建实现

    package com.loaderman.uiframedemo; import android.os.Bundle; import android.support.v4.app.Fragment; ...

  6. 190628 - 解决新版本LastPass没有谷歌套件时打开就闪退的问题.md

    目录 解决新版本LastPass没有谷歌套件时打开就闪退的问题 可用解决方案 可用解决方案3 可用解决方案2 可用解决方案1 尝试安装 碰到的问题列表 问题现象 解决新版本LastPass没有谷歌套件 ...

  7. HTTP Status 500 – Internal Server Error

    明明硬盘中存在users.xml,但是提示:系统找不到指定的路径. 解决办法: 设置String的编码格式 realpath = URLDecoder.decode(realpath, "U ...

  8. DELPHI 通用的数据记录复制过程

    //表名,关键字段名,单条内容的SQL语句,产生新记录的值 function Tfrmdmmain.CopyTbale(const tablename, fileldname, swhere, new ...

  9. java:ssh连接服务器,实现本地文件上传和下载

    1.连接至服务器:ssh hp@10.10.17.16 -p 5555    下载文件:scp -r hp@10.10.17.16:/ccc(服务器路径,文件夹下所有文件)  /path(本地路径) ...

  10. HBITMAP与BITMAP 的区别

    HBITMAP   是句柄:  BITMAP    是实例:    typedef   struct   tagBITMAP {             LONG       bmType;      ...