diff --git a/tools/arkmanager b/tools/arkmanager index c672f1a..7ff8646 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -1427,6 +1427,22 @@ doBackup(){ echo -e "${NORMAL}\e[68G[ ${RED}FAILED${NORMAL} ]" fi echo -e "${NORMAL} Created Backup: ${GREEN} ${datestamp}.tar.bz2${NORMAL}" + + if [ -n "$arkMaxBackupSizeGB" ] && (( arkMaxBackupSizeGB >= 1 )); then + (( arkMaxBackupSizeMB = arkMaxBackupSizeGB * 1024 )) + fi + + if [ -n "$arkMaxBackupSizeMB" ] && (( arkMaxBackupSizeMB > 64 )); then + find "${arkbackupdir}" -type f -printf "%T@\t%s\t%p\n" | + sort -n -r | + cut -f2-3 | + (sz=0; while read fsz f; do + if (( sz / 1048576 > arkMaxBackupSizeMB )); then + rm "$f" + fi + (( sz += fsz )) + done) + fi } diff --git a/tools/arkmanager.cfg b/tools/arkmanager.cfg index 7210555..9d8533a 100644 --- a/tools/arkmanager.cfg +++ b/tools/arkmanager.cfg @@ -16,9 +16,13 @@ arkbackupdir="/home/steam/ARK-Backups" # path to ba arkwarnminutes="60" # number of minutes to warn players when using update --warn arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating -arkTimeToKeepBackupFiles="10" #Set to Automatically Remove backups older than n days #arkStagingDir="/home/steam/ARK-Staging" # Uncomment to enable updates to be fully downloaded before restarting the server (reduces downtime while updating) +# Options to automatically remove old backups to keep backup size in check +# Each compressed backup is generally about 1-2MB in size. +arkMaxBackupSizeMB="500" # Set to automatically remove old backups when size exceeds this limit +#arkMaxBackupSizeGB="2" # Uncomment this and comment the above to specify the limit in whole GB + # Update warning messages # Modify as desired, putting the %d replacement operator where the number belongs msgWarnUpdateMinutes="This ARK server will shutdown for an update in %d minutes"