Edit: this one is continuous and rsync is one-shot. Personally, I've been using inotify+rsync+timeout (intofy+rsync has a race condition, so limiting the inotify wait and syncing anyway is essential). Does sshync avoid the race?
Edit: this one is continuous and rsync is one-shot. Personally, I've been using inotify+rsync+timeout (intofy+rsync has a race condition, so limiting the inotify wait and syncing anyway is essential). Does sshync avoid the race?
Here is a tip on how it can be used ( not tested )
#!/bin/bash
WATCH_PATH="/some/path"
DEST_PATH="/some/path"
REMOTE="root@example.com"
while read LINE; do
FILE=$(echo ${LINE} | cut -d' ' -f2 )
/usr/bin/rsync -r ${FILE} ${REMOTE}:${DEST_PATH}
done < <(/usr/bin/inotifywait -mq -e CLOSE_WRITE --format "%w %f" ${WATCH_PATH})
1 : http://linux.die.net/man/1/inotifywaitAlso, unless you have a very large (breadth or depth) tree, you can just let rsync synchronize the entire path - it is quite efficient, will pick up additional diretories (you need inotifywait -r for that, and AFAIK you still have an unavoidable race).
And what happens to an rsync file that is modified while in the middle of a transfer? [1](I haven't been able to find satisfactory answers to these questions hence the question here).
[1] Say you have a 1,000,000 line file that you are rsynch-ing and you delete line 50000 and insert at line 750000?
Re changing file - IIRC it will keep Resending until file size+mtime at end of transfer is same as in the beginning.
Edit: I am now noticing this tool isn't even maintained anymore.
"Rsync is a mirroring tool; Unison is a synchronizer. That is, rsync needs to be told "this replica contains the true versions of all the files; please make the other replica look exactly the same." Unison is capable of recognizing updates in both replicas and deciding which way they should be propagated."
(your profile mentions to respond to one of your comments if someone needs to reach you ...)
I now use rsync for bidirectional mirroring (any two versions from the last 15 years or so can talk to each other), git for synchronization (getting history for the price of needing to add/commit). Can't beat the network efficiency and compatibility of these two.