É melhor você usar o Observador para executar rsync
sempre que um arquivo for alterado. É baseado em incron
, mas pode monitorar diretórios recursivamente.
$ git clonet git://github.com/splitbrain/Watcher.git
$ cd Watcher
$ cp watcher.ini ~/.watcher.ini
~/.watcher.ini
[DEFAULT]
logfile=/tmp/watcher.log
pidfile=/tmp/watcher.pid
[job1]
watch=/home/quanta/x
events=create,delete
recursive=true
autoadd=true
command=rsync -vaz quanta@localhost:~/x ~/y --log-file=/home/quanta/rsync.log
Iniciando o daemon:
$ ./watcher start
$ ps -ef | grep [w]atcher
quanta 3695 1 0 17:01 ? 00:00:00 /usr/bin/python2.7 ./watcher.py restart
rsync.log
2012/08/16 17:01:42 [3710] receiving file list
2012/08/16 17:01:42 [3724] .d..t...... x/
2012/08/16 17:01:42 [3724] >f.st...... x/a.txt
2012/08/16 17:01:42 [3724] sent 42 bytes received 180 bytes 444.00 bytes/sec
2012/08/16 17:01:42 [3724] total size is 45 speedup is 0.20
2012/08/16 17:01:42 [3731] receiving file list
2012/08/16 17:01:42 [3745] sent 14 bytes received 103 bytes 234.00 bytes/sec
2012/08/16 17:01:42 [3745] total size is 45 speedup is 0.38
2012/08/16 17:01:42 [3752] receiving file list
2012/08/16 17:01:42 [3766] sent 14 bytes received 103 bytes 234.00 bytes/sec
2012/08/16 17:01:42 [3766] total size is 45 speedup is 0.38
2012/08/16 17:01:42 [3773] receiving file list
2012/08/16 17:01:42 [3787] sent 14 bytes received 103 bytes 234.00 bytes/sec
2012/08/16 17:01:42 [3787] total size is 45 speedup is 0.38