Commit 93cc61cb authored by Xavier Thompson's avatar Xavier Thompson

stack/erp5: Fix restore-from-backup script

The `restore-from-backup` script starts by deleting existing data
from `srv/mariadb` before starting mariadb and importing backups.

Before this commit, it would only delete the contents of `srv/mariadb`
and crash if this directory did not exist.

But the mariadb service only reinitialises `srv/mariadb` if it does
not exist when the service starts, and instead crashes if it exists
but is merely empty.

So the `restore-from-backup` script must actually delete the whole
directory and not just it's contents, and it must not crash if the
directory already does not exists.
parent 4b095148
......@@ -14,7 +14,7 @@
# not need these here).
[mariadb-resiliency-after-import-script]
filename = instance-mariadb-resiliency-after-import-script.sh.in
md5sum = 85ce1e2f3d251aa435fef8118dca8a63
md5sum = 3d8446b7b74cd0d968915034569418ff
[mariadb-slow-query-report-script]
filename = mysql-querydigest.sh.in
......
......@@ -31,8 +31,8 @@ if [ -e "$pid_file" ]; then
fi
fi
echo "Deleting existing database..."
find "$mariadb_data_directory" -mindepth 1 -delete
# Delete database if it exists
rm -rf "$mariadb_data_directory"
# $binlog_path can be empty if incremental_backup_retention_days <= -1
if [ -n "$binlog_path" ]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment