Skip to content

Commit

Permalink
World backup fixed by jbondhus
Browse files Browse the repository at this point in the history
Empty folders are no longer created each day. See issue 64 for more
info.
  • Loading branch information
Ahtenus committed Apr 10, 2012
1 parent 0e48cb8 commit f4051a9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions minecraft
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,29 @@ mc_world_backup() {
for INDEX in ${!WORLDNAME[@]}
do
echo "Backing up minecraft ${WORLDNAME[$INDEX]}"
as_user "mkdir -p $BACKUPPATH/${today}"

This comment has been minimized.

Copy link
@jbondhus

jbondhus Apr 11, 2012

Contributor

Changed the today folder to only be made if compatibility with the backup rolling script is disabled.


case "$BACKUPFORMAT" in
tar)
if [ "$BACKUPSCRIPTCOMPATIBLE" ]
# If isset tars will be put in $BACKUPPATH without any timestamp to be compatible with
# [backup rotation script](https://github.com/adamfeuer/rotate-backups)
# If is set tars will be put in $BACKUPPATH without any timestamp to be compatible with
# [backup rotation script](https://github.com/adamfeuer/rotate-backups)
then
echo "Deleting old backup of ${WORLDNAME[$INDEX]}"

This comment has been minimized.

Copy link
@jbondhus

jbondhus Apr 11, 2012

Contributor

Warns the user that it is deleting the obsolete backup of the world that is about to be backed up.

as_user "rm -r $BACKUPPATH/${WORLDNAME[$INDEX]}.zip"

This comment has been minimized.

Copy link
@jbondhus

jbondhus Apr 11, 2012

Contributor

Deletes the old backup of the world so that it can properly write a new one.

path=$BACKUPPATH/${WORLDNAME[$INDEX]}.tar.bz2
else
as_user "mkdir -p $BACKUPPATH/${today}"
path=`datepath $BACKUPPATH/${today}/${WORLDNAME[$INDEX]}_ .tar.bz2 .tar.bz2`
fi
as_user "tar -hcjf $path $MCPATH/${WORLDNAME[$INDEX]}"
;;
zip)
if [ "$BACKUPSCRIPTCOMPATIBLE" ]
then
echo "Deleting old backup of ${WORLDNAME[$INDEX]}"
as_user "rm -r $BACKUPPATH/${WORLDNAME[$INDEX]}.zip"
path=$BACKUPPATH/${WORLDNAME[$INDEX]}.zip
else
as_user "mkdir -p $BACKUPPATH/${today}"
path=`datepath $BACKUPPATH/${today}/${WORLDNAME[$INDEX]}_ .zip .zip`
fi
as_user "zip -rq $path $MCPATH/${WORLDNAME[$INDEX]}"
Expand Down

0 comments on commit f4051a9

Please sign in to comment.