Minecraft-Server-Tools/backup

27 lines
852 B
Plaintext
Raw Normal View History

2021-10-10 02:14:34 +02:00
#!/bin/bash
# config
instances_dir=$HOME/instances
backups_dir=$HOME/backups
2021-10-10 20:29:31 +02:00
tmpdir=$backups_dir/tmp
2021-10-10 02:14:34 +02:00
backup_timestamp=`date +%Y-%m-%d_%H.%M.%S`
2021-10-10 20:29:31 +02:00
echo "WARNING: This script is deprecated and will be reworked to support incremental backups soon."
2021-10-10 02:14:34 +02:00
# desired features:
# - incremental backups
# - converter from old backups to incremental backups
# - override options for config instead of hardcoded values
2021-11-21 14:03:21 +01:00
# - progrss bar
2021-10-10 20:29:31 +02:00
# - display total time it took to make the backup
2021-10-10 02:14:34 +02:00
# 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
2021-10-10 20:29:31 +02:00
mv -v "$tmpdir/$backup_timestamp.tar.xz" "$backups_dir"
echo "WARNING: This script is deprecated and will be reworked to support incremental backups soon."