zoukankan      html  css  js  c++  java
  • rsync同步目录

    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    -r, --recursive             recurse into directories
    -l, --links                 copy symlinks as symlinks
    -p, --perms                 preserve permissions
    -t, --times                 preserve modification times
    -g, --group                 preserve group
    -o, --owner                 preserve owner (super-user only)
    -D                          same as --devices --specials
        --devices               preserve device files (super-user only)
        --specials              preserve special files
        
    -H, --hard-links            preserve hard links
    -A, --acls                  preserve ACLs (implies -p)
    -X, --xattrs                preserve extended attributes
    
    
    -P                          same as --partial --progress
    --partial
                  By  default,  rsync  will  delete  any partially transferred file if the transfer is interrupted. In some circum‐
                  stances it is more desirable to keep partially transferred files. Using the --partial option tells rsync to  keep
                  the partial file which should make a subsequent transfer of the rest of the file much faster.
                  断点续传
    --progress
                  This option tells rsync to print information showing the progress of the transfer. This gives a bored user  some‐
                  thing  to  watch.   With  a  modern  rsync  this  is  the same as specifying --info=flist2,name,progress, but any
                  user-supplied settings for those info flags takes precedence (e.g. "--info=flist0 --progress").
                  显示传输进度
                  
                  
    -v, --verbose
                  This  option increases the amount of information the daemon logs during its startup phase.  After the client con‐
                  nects, the daemon’s verbosity level will be controlled by the options that the client  used  and  the  "max  ver‐
                  bosity" setting in the module’s config section.
                  输出详细信息
                  
                  
    --delete
                  This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending  side),  but
                  only  for  the  directories  that  are being synchronized. 
                
    推荐用法:
    rsync -aP  --delete . /tmp/20180619/
    rsync -av  --delete --progress . /tmp/20180619/


    [root@prdweb02 ~]# ll | grep tes
    -rw-r--r-- 1 root root 139351040 Dec 25 11:48 kubernetes-dashboard-amd64.tgz
    drwxr-xr-x 3 root root 92 Feb 20 18:06 test_compose

    源目录后加/则只会把这个目录下的内容复制过去

    [root@prdweb02 ~]# rsync -aP  --delete test_compose/ /tmp/20180619/

    源目录后不加/则会把这个目录本身也复制过去

    [root@prdweb02 ~]# rsync -aP  --delete test_compose /tmp/20180619/

  • 相关阅读:
    day1-python简介+安装
    dgango中admin下添加搜索功能
    调用zabbix 分组api
    python 调用zabbix api实现查询主机信息,输出所有主机ip
    python实现用户登录界面
    怎样过滤跨站恶意脚本攻击(XSS)
    java服务安装(一):使用java service wrapper及maven打zip包
    详解Maven项目利用java service wrapper将Java程序生成Windows服务
    使用tomcat7-maven-plugin部署Web项目
    常用Maven插件介绍
  • 原文地址:https://www.cnblogs.com/goozgk/p/9201732.html
Copyright © 2011-2022 走看看