First commit

This commit is contained in:
pezcurrel 2024-07-26 22:17:46 +02:00
parent 76a306ffb5
commit 90bea57faa

View file

@ -0,0 +1,20 @@
#!/bin/bash
set -e
DBNAME="mastostart"
basedir=$(dirname "$0")
cd "${basedir}/backups"
xzfp=`ls -1 --time=birth -r *.xz 2>/dev/null | tail -n 1 2>/dev/null`
sqlfp=$(basename -s .xz "${xzfp}")
if [ -z "${xzfp}" ]; then
echo "No backup found :-(" 1>&2
else
echo "Uncompressing most recent backup file: «${xzfp}» ..."
xz -dk $xzfp
mariadb -u root -p "${DBNAME}" < "$sqlfp"
rm "${sqlfp}"
fi
exit 0