
実行中のPostfixおよびCourierサーバーファイルをバックアップすると、次のような警告がたくさん表示されます。
file has vanished: /var/kunden/mail/username/[email protected]/tmp/courier.lock
rsync
Cronで実行しているときにこれらの警告を表示したくない場合はどうすればよいですか/usr/bin/rsnapshot hourly
?
どういうわけかこのディレクトリを除外できますか?
/var/kunden/mail/*/*/tmp/
フォルダtmp
はより深くなる可能性があります。たとえば、次のようになります。
file has vanished: /var/kunden/mail/username/[email protected]/.Presse/tmp/1353871473.M716135P32214_imapuid_36.test.de
file has vanished: /var/kunden/mail/username/[email protected]/.Presse/tmp/courier.lock
答え1
残念ながら、SWdreamのソリューションで説明されているものとは異なり、--ignore-missing-args
ファイルが消えるには影響はありません。存在しないソースパラメータは無視されます。
バラよりman rsync
:
--ignore-missing-args When rsync is first processing the explicitly requested source files (e.g. command-line arguments or --files-from entries), it is normally an error if the file cannot be found. This option suppresses that error, and does not try to transfer the file. This does not affect subsequent vanished-file errors if a file was initially found to be present and later is no longer there.
消えるファイルを無視する「公式の」方法は、公式のrsyncソースストアで次のスクリプトを使用することです。 https://git.samba.org/?p=rsync.git;a=blob_plain;f=support/rsync-no-vanished;hb=HEAD
これは@kenorbと@gilles-quenotが言ったものと非常に似ています。
答え2
その理由は、rsync が転送するファイルのリストを作成すると、これらのファイルが存在するが転送前に削除されるためです。
これはエラーではなく警告メッセージです。ただし、これらのファイルが削除された理由を特定しようとする必要があります。これは重要かもしれません。
この警告を無視するには、上記の質問のように--excludeオプションを使用するか、-ignore-missing-args
rsyncオプションを使用すると、rsyncが消えるファイルを無視します。
--ignore-missing-args ignore missing source args without error
役に立つかもしれません。
答え3
利用可能なrsync
スイッチを除く(--exclude
):
$ rsync -avz --exclude '**/tmp/' source/ destination/
この方法を指定すると、--exclude '**/tmp/'
文字列を含むすべてのパスは無視されます/tmp/
。このパラメータのパターンを提供することもできます。
はい
$ rsync -avz --exclude '/path/to/*/tmp/' source/ destination/
次の形式のパスは除外されます/path/to/*/tmp/
。
答え4
または単に(現代強く打つ):
#!/bin/bash
/usr/bin/rsync "$@" 2> >(grep -Ev '(file has |rsync warning: some files )vanished')
ret=$?
((ret==24)) && exit 0 || exit $ret