zoukankan      html  css  js  c++  java
  • rsync实时同步文件

    http://rsync.samba.org/download.html
    
    [root@v01 src]# yum install git
    
    [root@v01 src]# git clone git://git.samba.org/rsync.git
    
    [root@v01 src]# git clone git://git.samba.org/rsync.git
    Initialized empty Git repository in /usr/local/src/rsync/.git/
    remote: Counting objects: 25470, done.
    remote: Compressing objects: 100% (9736/9736), done.
    
    [root@v01 local]# which rsync
    /usr/bin/rsync
    
    [root@v01 local]# rpm -qf /usr/bin/rsync 
    rsync-3.0.6-12.el6.x86_64
    
    [root@v01 www]# rsync -a webtest/ online/
    [root@v01 www]# tree online/
    online/
    ├── authz
    ├── index.html
    └── index.php
    
    0 directories, 3 files
    [root@v01 www]# cd online/
    [root@v01 online]# ll -all
    total 24
    drwxr-xr-x. 3 www  www  4096 May  9 12:03 .
    dr-xr-xr-x. 6 www  www  4096 May  9 12:42 ..
    -rw-r--r--. 1 root root 1080 May  9 12:03 authz
    -rw-r--r--. 1 root root   31 May  9 11:40 index.html
    -rw-r--r--. 1 root root   17 May  9 10:42 index.php
    drwxr-xr-x. 6 root root 4096 May  9 12:03 .svn
    
    [root@v01 www]# rsync -v webtest/* online/ #如果加*(如:webtest/*),则.xxx的隐藏文件不会被同步
    authz
    index.html
    index.php
    
    sent 1315 bytes  received 69 bytes  2768.00 bytes/sec
    total size is 1128  speedup is 0.82
    [root@v01 www]# cd online/
    [root@v01 online]# ls
    authz  index.html  index.php
    [root@v01 online]# ll -all
    total 20
    drwxr-xr-x. 2 root root 4096 May  9 12:51 .
    dr-xr-xr-x. 6 www  www  4096 May  9 12:50 ..
    -rw-r--r--. 1 root root 1080 May  9 12:51 authz
    -rw-r--r--. 1 root root   31 May  9 12:51 index.html
    -rw-r--r--. 1 root root   17 May  9 12:51 index.php
    
  • 相关阅读:
    gradle平级项目引用
    java使用ssh访问Linux的项目jscraft
    debian更新源时找不到公钥的解决办法
    debian系在线安装软件apt-get命令族
    vim打造开发IDE
    Mysql主从同步配置
    byte[] 转Hex String
    记录一次条件比较多的SQL查询语句
    LruCache的缓存策略
    LinkedHashMap的实现原理
  • 原文地址:https://www.cnblogs.com/bass6/p/5485902.html
Copyright © 2011-2022 走看看