• 1 
瀏覽模式: 普通 | 列表

rsync 應用

Linux 平台有個指令 rsync (也有 Windows 版)

我作個實作

環境:
1. 被 rsync 來源為 /var/log

2. rsync 目的到 /root/cross

3. /var/log 裡面有 archives  檔案 跟 xxx/archives 目錄(xxx 及 xxx/arvhives 皆是目錄)

我如果下

rsync -av --delete --delete-excluded --exclude=archives /var/log/ /root/cross/

結果會 arvhives 檔案 及 /var/log/xxx/arvhives 目錄皆不會被 rsync

如果是

rsync -av --delete --delete-excluded --exclude=xxx/archives /var/log/ /root/cross/

只有 /var/log/xxx/archives 目錄不會被 rsync,而 /var/log/archives 檔案會被 rsync

標籤: 同步 rsync

Backup + Rsync + SSH

架構:
一、A 使用 ssh 登入 B 不用密碼
二、把 B 的東西備份到 A

一、參考ssh + no password login作法

      ref: http://ssorc.tw/index.php?load=read&id=260

二、A 端執行 rsync,會把 B 端的 httpd 目錄 放至 A 端的 httpd_tmp 目錄裡
      rsync -av --delete -e ssh 192.168.1.12:/var/log/httpd /var/log/httpd_tmp

現在習慣這麼下
rsync -av --delete root@192.168.1.12:/var/log/httpd /var/log/httpd_tmp
 
參考文件:
http://fanqiang.chinaunix.net/a6/b7/20010908/1305001258_b.html
http://linux.tnc.edu.tw/techdoc/rsync.htm
http://phorum.study-area.org/viewtopic.php?t=15553
http://www.adj.idv.tw/server/linux_rsync.php
http://phorum.study-area.org/viewtopic.php?t=23179&highlight=ssh-keygen

標籤: 備份 ssh rsync

  • 1