s3cmd, set low verbosity

Val*_*uss 4 python amazon-s3 s3cmd

I currently use s3cmd to sync backups from our servers to amazon s3. I do this using a cron similar to the following:

MAILTO=my@email.address
01 03 * * * s3cmd sync /root/backup/backups/ s3://somebucket/
Run Code Online (Sandbox Code Playgroud)

This is just a sample, the files to be synced are already in the backups directory. Currently when I use this, I quite often get warnings about the upload fails (connect reset by peer) and then the retries. After 1 or 2 retries the upload generally gets there.

What I'd like to know is can I change the verbosity of s3cmd to only log output when it actually errors, rather than warns so that I only get emailed when I need to look at something?

您似乎可以在.s3cmd首选项文件中设置它,但我想确保.

谢谢

dcr*_*cro 5

如果您有更新版本s3cmd,请尝试--quiet(或-q)选项:

MAILTO=my@email.address
01 03 * * * s3cmd sync --quiet /root/backup/backups/ s3://somebucket/
Run Code Online (Sandbox Code Playgroud)

如果没有,只需重定向STDOUT/dev/null这样:

MAILTO=my@email.address
01 03 * * * s3cmd sync /root/backup/backups/ s3://somebucket/ >/dev/null
Run Code Online (Sandbox Code Playgroud)

发送错误,STDERR以便仍然可以通过电子邮件发送.

关于S3CMD和STDERR的更新:

正如Valguss指出的那样,似乎s3cmd始终记录调试,信息,警告和错误消息,STDERR因此上述方法将无法正常工作.

但是,可以从.s3cfg文件(在本例中位于与cron作业关联的用户的主目录中)控制详细级别:

[default]
verbosity = ERROR
Run Code Online (Sandbox Code Playgroud)

此时ERROR无法通过命令行参数配置详细级别.