rsync实时同步文件,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

 

相关内容