4 ms·
Yes it combines also amazingly well with inotifywait[1], perhaps there is a port for other OS-es too. Here is a tip on how it can be used ( not tested ) #
by drinchev 11y ago
Yes it combines also amazingly well with inotifywait[1], perhaps there is a port for other OS-es too.
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/inotifywait http://linux.die.net/man/1/inotifywait
- beagle3 11y agoFor most uses, rsync -a (preserve all possible metadata, like cp -a) is preferable to rsync -r ; Also, 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).