initial update backupscript to use with simple leveldb database

This commit is contained in:
Milan* 2018-04-10 11:14:05 +02:00
parent bf77eb6e5a
commit 2d91c64e32

View File

@ -2,6 +2,7 @@
# Illuna Minetest Backup
#
set -e
user=illuna
# the backupscript of the Illuna Minetest Universe.
# this may only be interesting for you when you use
@ -25,15 +26,10 @@ world1=vip-world
world2=ctf
world3=techeth
world3Minetest=illuna-techeth-minetestserver
world3Database=illuna-techeth-mtredisalize
backupdir='/home/illuna/backups'
#sftpdir='/ftp/illuna/'
# location of the ssdb dumptool
#
dumptool='/usr/local/ssdb/ssdb-dump'
ip='127.0.0.1'
port1='8888'
#port2='8889'
port3='8890'
date=`date '+%y%m%d%H%M'`
tmp=$backupdir/$date
@ -49,38 +45,35 @@ backupfile=$backupdir/${date}.tar.gz
#####################################################################
echo "create our working directory"
#
mkdir -p $tmp
su - $user -c "mkdir -p $tmp"
echo "sync all the stuff to the tmp directory"
# excluding rollback as this is not relevant
# when restoring from backup and only takes
# bunch of space.
#
ionice -c3 rsync -arptg --temp-dir=/var/tmp/rsync $configdir $worldsdir/$world2 $worldsdir/$world3 $tmp/ --exclude database --exclude rollback.sqlite
su - $user -c "ionice -c3 rsync -arptg $configdir $worldsdir/$world2 $worldsdir/$world3 $tmp/ --exclude database --exclude map.db --exclude rollback.sqlite"
echo "dump the worlds to the previously excluded"
# folder. later it should be possible to
# use the world directory without additional
# effort but we had to make shure the dump
# was done cleanly and using open files from
# ssdb may result in bad situations.
#
#ionice -c3 $dumptool $ip $port1 $tmp/$world1/database
#ionice -c3 $dumptool $ip $port2 $tmp/$world2/database
ionice -c3 $dumptool $ip $port3 $tmp/$world3/database
echo "stop Minetest servers"
systemctl stop $world3Minetest
echo "give Minetest some time...."
sleep 5
echo "stop DB servers"
systemctl stop $world3Database
sleep 2
echo "packing..."
#
ionice -c3 tar -czf $backupfile $tmp/*
rm -rf $tmp
sftpdir=/home/illuna/mnt
#curlftpfs dedibackup-dc3.online.net/illuna $sftpdir
#cp $backupfile $sftpdir
/usr/local/bin/mc cp $backupfile t1/backups/minetest/
echo "compress the worlds"
# TODO make the archive structure more logical (see alone map.db)
su - $user -c "ionice -c3 tar -czf $backupfile $tmp/* $worldsdir/$world3/map.db"
systemctl start $world3Database
sleep 2
systemctl start $world3Minetest
su - $user -c "rm -rf $tmp"
su - $user -c "/usr/local/bin/mc cp $backupfile t1/backups/minetest/"
# vacuum the backup directory
#
rm -rf $backupfile
/usr/local/bin/mc rm --force --older-than=4 t1/backups/minetest/
su - $user -c "rm -rf $backupfile"
su - $user -c "/usr/local/bin/mc rm --force --older-than=4 t1/backups/minetest/"