k0lter / autopostgresqlbackup

Automated tool to make periodic backups of PostgreSQL databases
52 stars 17 forks source link

Feature request in v2: Warn if below minimum size #15

Closed hyperman2 closed 1 year ago

hyperman2 commented 1 year ago

autopostgresqlbackup cgecks uf a dump file is empty:

if [ ! -s "${dump_file}" ]; then log_error "Something went wrong '${dump_file}' is empty (no space left on device?)" fi

I would love it if the test checks not for 0 bytes, but for a user-configurable threshold. So i say in the config file

MINIMUM_BACKUP_SIZE=1024

and it warns me if any produced .sql or .pgdump file is less than 1024 bytes.

I ask this because I've managed to get some dumps that are 0 bytes, or only contain a short error message. But after compressing these files, they grow to >0 bytes.

As a bonus, if the total backup size is below some threshold, that would also merit logging an error, but the needed adaptations for this are probably a lot bigger.

k0lter commented 1 year ago

Your 2 requests seems legitimate, I will keep you informed.

k0lter commented 1 year ago

I've added this feature, even if I think that the fix in #14 should avoid to have 0 bytes dumps.

See Changelog for the new option.

hyperman2 commented 1 year ago

This works perfectly. Thanks.