1. 往远程服务器上传送文件
/usr/bin/rsync -vzrtopg html rsync://113.12.52.32/nginx
在113.12.52.32配置(/etc/rsyncd.conf)
uid = root
gid = root
use chroot = no
transfer logging = true
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log format = %h %o %f %l %b
log file = /logs/rsyncd.log
[nginx]
path = /data1/nginx
comment = backup-nginx-log
ignore errors = yes
read only = no
uid = root
gid = root
list = no
#hosts allow
host deny = *
同时启动进程 /usr/bin/rsync --daemon --config=/etc/rsyncd.conf
2.从远程服务器往本地传东西
1)需在远程服务器上配置hosts allow
2)在远程服务器上启动进程 /usr/bin/rsync --daemon --config=/etc/rsyncd.conf
3)/usr/bin/rsync -av rsync://106.38.226.149/checkin /haha/www/checkin
3.在本地复制文件夹
rsync -a /var/www/html /var/local
4.查看远程服务器文件夹下有哪些目录
/usr/bin/rsync -v rsync://113.12.52.32/nginx
receiving file list ... done
drwxrwxrwx 4,096 2015/05/19 23:10:09 .
drwxr-xr-x 17 2015/08/03 09:00:00 api.app
drwxr-xr-x 17 2015/08/03 09:01:00 apimy
drwxr-xr-x 17 2015/08/03 09:00:01 apisso
drwxr-xr-x 17 2015/08/03 09:06:01 card
drwxr-xr-x 17 2015/08/03 09:06:01 checkin
drwxr-xr-x 17 2015/08/03 09:01:00 clientPc
drwxr-xr-x 17 2015/08/03 09:01:01 common
drwxr-xr-x 17 2015/08/03 09:00:01 m_touch
drwxr-xr-x 17 2015/08/03 09:00:01 touch
drwxr-xr-x 17 2015/08/03 09:01:00 vcs
sent 27 bytes received 410 bytes 874.00 bytes/sec
total size is 0 speedup is 0.00