Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

s3cmd, set low verbosity

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

[email protected]
01 03 * * * s3cmd sync /root/backup/backups/ s3://somebucket/

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?

It appears you might be able to set this in the .s3cmd preference file, but I wanted to make sure.

Thanks

like image 755
Valguss Avatar asked Mar 23 '23 10:03

Valguss


1 Answers

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

[email protected]
01 03 * * * s3cmd sync --quiet /root/backup/backups/ s3://somebucket/

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

[email protected]
01 03 * * * s3cmd sync /root/backup/backups/ s3://somebucket/ >/dev/null

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

UPDATE ABOUT S3CMD and STDERR:

As Valguss pointed out, it seems that s3cmd always logs debug, info, warning and error messages to STDERR so the above methods will not work.

However, the verbosity level 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

A verbosity level of ERROR can not be configured via command line parameters at this time.

like image 86
dcro Avatar answered Apr 05 '23 11:04

dcro