linux下rsync的使用

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值