Rotate Backups with logrotate

Why recreate the tasks available with logrotate? It’s already installed.

Say you’re backing up files something like this:

# tar czf /backups/full.tgz /

Now you can have logrotate manage rotating the old ones out, keeping the new ones in order with a quick config:

# cat /etc/logrotate.d/backups
/backups/full.tgz {
    rotate 10
    daily
    nocompress
    notifempty
}

The rest is automatic.