forked from nalc/nalc-server
48 lines
1.1 KiB
Bash
Executable File
48 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Variables à modifier
|
|
bdd=nalc-0.4.17
|
|
worldname=nalc
|
|
servername=nalc-server-0.4.17-r1
|
|
|
|
serverpath=/home/minetest/$servername
|
|
bak=$serverpath/backup
|
|
world=$serverpath/minetest/worlds/$worldname
|
|
|
|
if [[ ! -d $bak ]]; then
|
|
mkdir -p $bak
|
|
fi
|
|
|
|
bak_tmp=/var/tmp/$servername
|
|
if [[ ! -d $bak_tmp ]]; then
|
|
mkdir $bak_tmp
|
|
fi
|
|
|
|
cp $serverpath/minetest/minetest.conf $bak/
|
|
cp $serverpath/start.sh $bak/
|
|
cp $serverpath/backup.sh $bak/
|
|
cp $serverpath/shutdown.sh $bak/
|
|
|
|
pushd $world
|
|
rm -r rollback.sqlite
|
|
tar -I pbzip2 -cf $bak/world.tar.bz2 . # <-- requiert pbzip2, à installer avant !
|
|
popd
|
|
|
|
pg_dump -F c -f $bak_tmp/$bdd.dump $bdd
|
|
pg_dump -F c -f $bak_tmp/players-$bdd.dump players-$bdd
|
|
|
|
pushd $bak_tmp
|
|
tar --label=SQL_DUMP-$servername -cf $bak/dump_sql.tar --remove-files *.dump
|
|
popd
|
|
|
|
log_dir=$serverpath/logs
|
|
[[ ! -d $log_dir ]] && mkdir $log_dir
|
|
pushd $log_dir
|
|
if [[ -f moredebug.log ]]; then
|
|
d=$(date +%Y-%m-%d.%H.%M.%S)
|
|
mv moredebug.log moredebug_$d.log
|
|
bzip2 moredebug_$d.log
|
|
tar --label=LOGS-$servername -rf moredebug-logs.tar --remove-files moredebug*.log.bz2
|
|
fi
|
|
popd
|