48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Minetest-Backup
|
|
set -e
|
|
|
|
DUMPTOOL="/home/minetest/ssdb-master/tools/ssdb-dump"
|
|
MAP="/var/minetest/illuna_world"
|
|
BACKUP_DIR="/home/minetest/backup"
|
|
NETSTORE="/mnt/net_storage/minetest/backup"
|
|
SSDBIP="127.0.0.1"
|
|
SSDBPORT="8888"
|
|
|
|
DATE=`date '+%y%m%d%H%M'`
|
|
|
|
BACKUP_FILE="${DATE}_Minetest_Backup.tar.bz2"
|
|
LATEST="${BACKUP_DIR}/latest.tar.bz2"
|
|
|
|
#echo "# creating working directory..."
|
|
mkdir $BACKUP_DIR/$DATE
|
|
|
|
#echo "# copy world directory and config to working directory..."
|
|
cp -r /home/minetest/illuna.conf $BACKUP_DIR/$DATE/
|
|
cp -r "${MAP}" $BACKUP_DIR/$DATE/
|
|
#echo "# done"
|
|
|
|
#echo "# delete rollback.sqlite"
|
|
rm $BACKUP_DIR/$DATE/illuna_world/rollback.sqlite
|
|
#echo "# done"
|
|
|
|
#echo "# begin database dump"
|
|
$DUMPTOOL $SSDBIP $SSDBPORT "$BACKUP_DIR/$DATE/ssdb-dump"
|
|
echo "# done"
|
|
|
|
#echo "# compressing...."
|
|
tar -cijf $BACKUP_DIR/$BACKUP_FILE $BACKUP_DIR/$DATE/
|
|
#echo "# done"
|
|
|
|
#echo "# uploading..."
|
|
cd /home/minetest
|
|
#megaput $BACKUP_DIR/$BACKUP_FILE --path '/Root/MinetestBackup/'
|
|
mv $BACKUP_DIR/$BACKUP_FILE $LATEST
|
|
|
|
#echo "# cleaning up..."
|
|
rm -r $BACKUP_DIR/$DATE --force
|
|
|
|
cp $LATEST $NETSTORE/$BACKUP_FILE
|
|
|
|
#echo "Letztes Backup: $DATE" > "$BACKUP_DIR/notify"
|