Minecraft-Sheller icon indicating copy to clipboard operation
Minecraft-Sheller copied to clipboard

Backups not clearing

Open Kdehner opened this issue 14 years ago • 4 comments

My minecraft.sh backup full is not clearing out old backups when run every night. Its backing up properly and i am getting full backups in my folder but non of the incriminates past 2 days are being removed and none of the full backups past 5 days are being removed. i have posted my Cron Jobs and the part of my .sh that has the backups.

Cron Job 3,18,33,48 * * * * /home//**/minecraft.sh sync >/dev/null 2>&1 5 1,5,7,9,11,13,15,17,19.21,23 * * * /home/**_/__/minecraft.sh backup 5 3 * * * /home/__/_******/minecraft.sh backup full

Minecraft.sh Backups BKUP_PATH=/home/************/minecraft_backups BKUP_DAYS_INCR=2 BKUP_DAYS_FULL=5

ALT_BACKUP=1 ALT_PATH=$MC_PATH/plugins

Also has full support been added for the plugins backup?

Kdehner avatar Jan 27 '12 03:01 Kdehner

This is the code that builds the purge list. If you go into the backup directory and run the commands below (changing the $BKUP_ values to be the real numbers)

find *-incr.tgz -type f -mtime +$BKUP_DAYS_INCR -print > purgelist

find *-full.tgz -type f -mtime +$BKUP_DAYS_FULL -print >> purgelist

Then check the 'purgelist' file that it created to see what files it found, or just remove the '>/>> purgelist' and it should print directly to the terminal.

endofzero avatar Jan 30 '12 05:01 endofzero

that's because the script is borked. If condition with -e (exists) arg is not setup correctly for wildcard searching when there is more than 1 result.

Change the lines from:

touch purgelist if [[ -e $BKUP_PATH/$WORLD/-incr.tgz ]]; then find $WORLD/-incr.tgz -type f -mtime +$BKUP_DAYS_INCR -print > purgelist fi if [[ -e $BKUP_PATH/$WORLD/-full.tgz ]]; then find $WORLD/-full.tgz -type f -mtime +$BKUP_DAYS_FULL -print >> purgelist fi

to:

touch purgelist if [[ -e echo $BKUP_PATH/$WORLD/*-incr.tgz | cut -d " " -f1 ]]; then find $WORLD/_-incr.tgz -type f -mtime +$BKUP_DAYS_INCR -print > purgelist fi if [[ -e echo $BKUP_PATH/$WORLD/_-full.tgz | cut -d " " -f1 ]]; then find $WORLD/*-full.tgz -type f -mtime +$BKUP_DAYS_FULL -print >> purgelist fi

(Code doesn't seem to be showing up exactly right in this comment. See: http://pastebin.com/nd7A3kgG )

Cyph3r avatar Feb 16 '12 20:02 Cyph3r

Also, the plugins stuff was never added by the developer, unfortunately. The variables are just dummy placeholders.

Cyph3r avatar Feb 16 '12 20:02 Cyph3r

If you want to add a pull request for any changes, I'll be glad to merge them.

I've been quite busy to be able to work on this, but I will be glad to merge any work that anyone else does.

endofzero avatar Feb 16 '12 21:02 endofzero