First commit
This commit is contained in:
parent
76a306ffb5
commit
90bea57faa
1 changed files with 20 additions and 0 deletions
20
web/clitools/maintain/restore.bash
Executable file
20
web/clitools/maintain/restore.bash
Executable 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
|
Loading…
Reference in a new issue