S3cmd, set low verbosity

I am currently using s3cmd to synchronize backups from our servers on amazon s3. I do this with cron, similar to the following:

MAILTO=my@email.address 01 03 * * * s3cmd sync /root/backup/backups/ s3://somebucket/ 

This is just a sample, the files that need to be synchronized are already in the backup directory. Currently, when I use this, I often get warnings about a download failure (connect reset to the peer), and then try again. After 1 or 2 repetitions, the download usually gets there.

What would I like to know, can I change the verbosity of s3cmd only to display the log when it is actually an error, and does not warn me that I only receive email when I need to look at something?

It looks like you can set this in your .s3cmd preferences file, but I wanted to make sure.

thanks

+4
source share
1 answer

If you have a newer version of s3cmd , try the --quiet (or -q ) option:

 MAILTO=my@email.address 01 03 * * * s3cmd sync --quiet /root/backup/backups/ s3://somebucket/ 

If not, just redirect STDOUT to /dev/null like this:

 MAILTO=my@email.address 01 03 * * * s3cmd sync /root/backup/backups/ s3://somebucket/ >/dev/null 

Errors are sent to STDERR , so they will still be emailed.

UPDATE About S3CMD and STDERR:

As Valguss noted, s3cmd always logs debug messages, information, warnings, and error messages before STDERR , so the above methods will not work.

However, the level of detail can be controlled from the .s3cfg file (located in the home directory for the user associated with the cron job in this case):

 [default] verbosity = ERROR 

The ERROR granularity cannot be configured using command line options at this time.

+5
source

Source: https://habr.com/ru/post/1502021/


All Articles