diff --git a/README.md b/README.md index 7fe772cb7..8fdaace41 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,8 @@ It is highly recommended you set the following environment values before startin | RCON_ENABLED*** | Enable RCON for the Palworld server | true | true/false | | RCON_PORT | RCON port to connect to | 25575 | 1024-65535 | | QUERY_PORT | Query port used to communicate with Steam servers | 27015 | 1024-65535 | +| DELETE_OLD_BACKUPS | Delete backups after a certain number of days | false | true/false | +| OLD_BACKUP_DAYS | How many days to keep backups | 30 | any positive integer | *highly recommended to set diff --git a/scripts/backup.sh b/scripts/backup.sh index 43eecb460..707df6ce0 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -15,3 +15,8 @@ if [ "$(id -u)" -eq 0 ]; then fi echo "backup created at $FILE_PATH" + +if [ "${DELETE_OLD_BACKUPS}" = true ]; then + echo "removing backups older than ${OLD_BACKUP_DAYS:=30} days" + find /palworld/backups/ -mindepth 1 -maxdepth 1 -mtime "+${OLD_BACKUP_DAYS}" -print -delete +fi