Commit 03592b81 by Julien Muchembled

ERP5: fix messages in MariaDB restoration script

Since the addition of `set -e`, several parts of the script became dead code.
1 parent a0bfc911
......@@ -14,7 +14,7 @@
# not need these here).
[mariadb-resiliency-after-import-script]
filename = instance-mariadb-resiliency-after-import-script.sh.in
md5sum = 0f8da748227de71aca93ae7b4a412c37
md5sum = aff3bb574c8f0a2db9911fee30540e12
[mariadb-slow-query-report-script]
filename = mysql-querydigest.sh.in
......
......@@ -21,8 +21,7 @@ server_executable='{{ server_executable }}'
# Make sure mariadb is not already running
if [ -e "$pid_file" ]; then
pid=$(cat "$pid_file")
if [ $? -ne 0 ]; then
if ! pid=$(cat "$pid_file"); then
echo "Cannot read Mariadb pidfile, assuming running. Aborting."
exit 1
fi
......@@ -60,13 +59,10 @@ fi
echo "Importing data..."
# Use latest dump XXX can contain funny characters
dump=$(ls -r "$mariadb_backup_directory" | head -1)
zcat "$mariadb_backup_directory/$dump" | $mysql_executable -u root
RESTORE_EXIT_CODE=$?
if [ $RESTORE_EXIT_CODE -eq 0 ]; then
echo 'Backup restoration successfully completed.'
else
zcat "$mariadb_backup_directory/$dump" | $mysql_executable -u root || {
RESTORE_EXIT_CODE=$?
echo 'Backup restoration failed.'
fi
exit $RESTORE_EXIT_CODE
}
exit $RESTORE_EXIT_CODE
echo 'Backup restoration successfully completed.'
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!