Add 'backup.sh'

master
Jan Danielzick 2021-10-10 02:14:34 +02:00
parent 497dc471d0
commit 19d2bbf82a
1 changed files with 23 additions and 0 deletions

23
backup.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# config
instances_dir=$HOME/instances
backups_dir=$HOME/backups
tmpdir=/tmp/minecraft-backup
backup_timestamp=`date +%Y-%m-%d_%H.%M.%S`
echo "WARNING: This script is deprecated and will be reworked to support incremental backup soon."
# desired features:
# - incremental backups
# - converter from old backups to incremental backups
# - override options for config instead of hardcoded values
# make sure it is there
mkdir -p -v "$tmpdir"
# tar
tar cvf "$tmpdir/$backup_timestamp.tar" "$instances_dir"
# compress
echo "Compressing backup..."
xz -z --best -T0 "$tmpdir/$backup_timestamp.tar"
# move to destination
mv -v "$tmpdir/$backup_timestamp.tar.xz" "$backups_dir"