Skip to content

Backup retention #2

@mark-cohen

Description

@mark-cohen

Enable/specify the # of backups to be retained, ala

how many backups to keep

KEEP_BACKUPS=7

backups_count=ls -1 $BACKUP_DIR | wc -l
backups_to_remove=$(($backups_count-$KEEP_BACKUPS))
if [ $backups_to_remove -gt 0 ]; then
for d in ls -1 $BACKUP_DIR | head -n$backups_to_remove; do
docmd "rm -rf $BACKUP_DIR/$d"
done
fi

More info:
https://gist.github.com/morhekil/8382294

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions