最後更新: 2018-05-28
介紹
Unison
file-synchronization tool
* Unison runs on both Windows and many flavors of Unix
* user-level program
if Unison is interrupted in the middle of transferring a large file, it will attempt to retransfer the whole thing on the next run.
License: GNU
Windows
https://www.irif.fr/~vouillon/unison/
Linux
Install
apt-get install unison
# 設定 ssh 的 login key
ssh-copy-id -i $HOME/.ssh/id_dsa.pub [email protected]
# Running Unison By ssh (Remote Shell Method)
unison /var/www ssh://192.168.0.101//var/www
# Config File
/root/.unison/default.prf
# 設定要 sync 的 path, e.g. root = /var/www and path = current translates to /var/www/current root = /var/www path = current #ignore = Name *.tmp ## ignores all files with the extension .tmp #ignore = Name stats* ## ignores all files/directories that begin with "stats" # skip asking for confirmations on non-conflicting changes. auto=true # user interface will ask no questions at all. # Non-conflicting changes will be propagated conflicts will be skipped. batch=true # Unison will request an extra confirmation if it appears that # the entire replica has been deleted, before propagating the change confirmbigdel=true fastcheck=true # sync premission group=true owner=true prefer=newer # Setting silent to true automatically sets the batch preference to true. silent=true # "file" mtime sync times=true
# Creating A Cron Job
*/5 * * * * /usr/bin/unison &> /dev/null
# Remark
slow links
you may get some speed improvement by enabling ssh's compression feature('-sshargs -C')
DOC
man unison
https://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html