You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
656 B

#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
filename="maps-$(date +%s).tar.gz"
(
echo "Starting backup at $(date) to $filename"
$DIR/backup_prepare.py
cd /opt/minecraft/server
tar -czf "../backups/$filename" world* || true 2>&1
size="$(du -h ../backups/$filename | awk '{ print $1 }')"
echo "Backup completed at $(date) with a size of $size"
$DIR/enable_autosave.py
echo "Backup done at $(date)!"
if [[ $1 == "--restart-after-backup" ]]; then
echo "Restart after backup was requested, initializing restart in 10 minutes"
$DIR/restart_server.py &
fi
) >> /opt/minecraft/tools/backup.log
echo $filename