January 19, 2012 | In: Nepotriedené
synchronize
Synchronizácia pomocu unison alebo rsync
pripravime si scenerio na testovanie:
# mkdir testdir1
# touch testdir1/foo testdir1/bar
# mkdir testdir1/null
# touch testdir1/null/foobar
# mkdir testdir2
spustíme unison:
# unison -ui text testdir1 testdir2
[…]
testdir1 testdir2
file —-> bar [f]
file —-> foo [f]
dir —-> null [f]
UNISON 2.32.52 started propagating changes at 18:40:57 on 19 Jan 2012
[BGN] Copying bar from /tmp/test/testdir1 to /tmp/test/testdir2
[END] Copying bar
[BGN] Copying foo from /tmp/test/testdir1 to /tmp/test/testdir2
[END] Copying foo
[BGN] Copying null from /tmp/test/testdir1 to /tmp/test/testdir2
[END] Copying null
UNISON 2.32.52 finished propagating changes at 18:40:57 on 19 Jan 2012
[..]
Saving synchronizer state
Synchronization complete at 18:40:57 (3 items transferred, 0 skipped, 0 failed)
pekne nám to oznámi co presne spravilo, skoplo 2 fajly a 1 zložku
Rsync – klasika
rsync -av -e ssh /DIR-1/* USER@pc-2:/DIR-2/
samozrejme musí byť rsync na oboch PC
-v je verbose čiže nám vypíše potrobné “dianie”
-a (archiv mod, eqvivalent k -rlptgoD) +-je rekurzia bez hardlinkov
-z kompresia
–exclude ktore fajly NECHCEME skopirova5
rsync -avz --exclude file1.txt --exclude dir3/file4.txt odkial/ kam/
reálny príklad može vyzerať neako takto:
rsync --recursive --perms --verbose --progress --stats --times --links --compress --exclude=".svn" --exclude="*~" --exclude="*.bak" --exclude="zend_cache--*" /var/www/google/api.bk/ /var/www/google/api 2>&1
Comments are closed.