2020-05-21 19:07:38 +00:00
|
|
|
if ! screen -list | grep -q "Minecraft"; then
|
2020-05-06 15:20:39 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-05-24 14:06:30 +00:00
|
|
|
BACKUPDIR="/home/bruno/Backups/zBackup-Minecraft/backups"
|
2020-05-21 19:07:38 +00:00
|
|
|
SERVERDIR="/home/bruno/Apps/Minecraft"
|
|
|
|
SURVIVALDIR="$SERVERDIR/BedrockServer_Survival_19132"
|
|
|
|
CREATIVEDIR="$SERVERDIR/BedrockServer_Creative_19134"
|
|
|
|
LogFile="log.txt"
|
2020-05-06 15:20:39 +00:00
|
|
|
|
2020-05-21 19:07:38 +00:00
|
|
|
alias run='screen -S Minecraft -X'
|
|
|
|
alias runSurvival='run at Survival stuff'
|
|
|
|
alias runCreative='run at Creative stuff'
|
|
|
|
alias runAllWorlds='run at "#" stuff'
|
2020-05-06 15:20:39 +00:00
|
|
|
|
2020-05-21 19:07:38 +00:00
|
|
|
cd /home/bruno/Apps/Minecraft
|
2020-05-06 15:20:39 +00:00
|
|
|
|
2020-05-21 19:07:38 +00:00
|
|
|
runAllWorlds "^u"
|
|
|
|
runAllWorlds "say $(date +%l:%M) - Saving worlds\n"
|
|
|
|
runAllWorlds "save hold\n"
|
|
|
|
sleep 2s
|
|
|
|
|
|
|
|
finishedCreative=""
|
|
|
|
timeout=30
|
|
|
|
while [[ $finishedCreative != *"Data saved."* ]]; do
|
|
|
|
if [[ $timeout -lt 1 ]]; then
|
|
|
|
notify-send "Error backuping Creative world"
|
|
|
|
exit 1
|
2020-05-06 15:20:39 +00:00
|
|
|
fi
|
2020-05-21 19:07:38 +00:00
|
|
|
(( timeout-- ))
|
|
|
|
sleep 1s
|
|
|
|
runCreative "^u"
|
|
|
|
runCreative "save query\n"
|
|
|
|
finishedCreative=$(tail -n 4 "$CREATIVEDIR/$LogFile")
|
|
|
|
done
|
2020-05-06 15:20:39 +00:00
|
|
|
|
2020-05-21 19:07:38 +00:00
|
|
|
timeout=30
|
|
|
|
finishedSurvival=""
|
|
|
|
while [[ $finishedSurvival != *"Data saved."* ]]; do
|
|
|
|
if [[ $timeout -lt 1 ]]; then
|
|
|
|
notify-send "Error backuping Survival world"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
(( timeout-- ))
|
|
|
|
sleep 1s
|
|
|
|
runSurvival "^u"
|
|
|
|
runSurvival "save query\n"
|
|
|
|
finishedSurvival=$(tail -n 4 "$SURVIVALDIR/$LogFile")
|
|
|
|
done
|
|
|
|
|
|
|
|
BACKUPDATE=$(date +"%Y-%m-%d_%H-%M-%S")
|
|
|
|
mkdir "$BACKUPDIR/$BACKUPDATE"
|
2020-05-24 14:11:07 +00:00
|
|
|
/bin/tar c --exclude=behavior_packs/* --exclude=resource_packs/* "$SURVIVALDIR/worlds/Survival" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE-Survival"
|
|
|
|
/bin/tar c --exclude=behavior_packs/* --exclude=resource_packs/* "$CREATIVEDIR/worlds/Creative" | zbackup --non-encrypted backup "$BACKUPDIR/$BACKUPDATE-Creative"
|
2020-05-21 19:07:38 +00:00
|
|
|
|
|
|
|
runAllWorlds "^u"
|
|
|
|
runAllWorlds "save resume\n"
|