• 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/

  • 相关阅读:
    C# richTextBox封装的一个打印的类
    RichtextBox打印
    RichTextBox选中文本时往自己的其他的位置实现拖拽
    C# 保存和读取TreeView展开的状态
    RichtextBox去除闪烁光标
    自己重启自己
    记录一次shell里局部变量的问题
    Redis配置总结
    Nginx原理和配置总结
    CentOS7+Nginx+多个Tomcat配置
  • 原文地址:https://www.cnblogs.com/goozgk/p/9201732.html
Copyright © 2020-2023  润新知