Commit 03592b81 authored by Julien Muchembled's avatar Julien Muchembled

ERP5: fix messages in MariaDB restoration script

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