毎分、記録されたファイルを3台のサーバーから1台のデータストレージにコピーする必要があります。元のファイルを保存する必要はありません。データ処理はすべてのファイルの外にあります。
しかし、オプションを使用する--remove-sent-files
と、rsyncは未完成の(閉じられていない)ファイルを送信および削除します。
私はこれらの開いているファイルをlsof
と--exclude-from
で送信しないように試みましたが、rsyncは除外リストのフルパスを理解していないようです:
--exclude-from=FILE read exclude >>patterns<< from FILE
lsof | grep /projects/recordings/.\\+\\.\\S\\+ -o | sort | uniq
/projects/recordings/<uid>/<path>/2012-07-16 13:24:32.646970-<id>.WAV
したがって、スクリプトは次のようになります。
# get open files in src dir and put them into rsync.exclude file
lsof | grep /projects/recordings/.\\+\\.\\S\\+ -o | sort | uniq > /tmp/rsync.exclude
# sync without these files
/usr/bin/rsync -raz --progress --size-only --remove-sent-files --exclude-files=/tmp/rsync.excldude /projects/recordings/ site.com:/var/www/storage/recordings/
# change owner
ssh storage@site.com chown -hR storage:storage /var/www/storage/recordings
だから、私は別のツールを試すべきでしょうか?または、なぜrsyncはexludesをリッスンしないのですか?