Retention policy for backup integration

It would be nice if the backup integration would get some kind of retention policy, for example “delete backups older then X days” similar to the recorder.

I currentely solve this through executing shell script that delete the backups in the file system. While this is working it’s not really convenient.

Seconded! I’ve filled up my drive a few times from forgetting to clear out backups. I have a long recorder history so the databases get HUGE.

1 Like
#!/bin/bash
HASS_FOLDER=/hass-backups
FILES_TO_KEEP=5
FILES_TO_DELETE=$((FILES_TO_KEEP+1))
echo "--- Rotating HASS backups"
ls -lt $HASS_FOLDER  | awk 'NR > 1' | tail -n +$FILES_TO_KEEP | xargs rm -rf

I vote for this :slight_smile: !