From e9787ef4e176a0dbb353acd6f5d9651740158f4d Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Fri, 24 Feb 2017 11:45:01 +0900 Subject: [PATCH] stack.erp5: Abort also if pidfile cannot be read. --- stack/erp5/buildout.hash.cfg | 2 +- .../instance-mariadb-resiliency-after-import-script.sh.in | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stack/erp5/buildout.hash.cfg b/stack/erp5/buildout.hash.cfg index 1e5a2baa4..e0a7238cb 100644 --- a/stack/erp5/buildout.hash.cfg +++ b/stack/erp5/buildout.hash.cfg @@ -15,7 +15,7 @@ # not need these here). [mariadb-resiliency-after-import-script] filename = instance-mariadb-resiliency-after-import-script.sh.in -md5sum = 5fc1bb6ade3458e0c2970c31ca7157ea +md5sum = 1e89de954d816b93f76d9b75820d192c [template-mariadb] filename = instance-mariadb.cfg.in diff --git a/stack/erp5/instance-mariadb-resiliency-after-import-script.sh.in b/stack/erp5/instance-mariadb-resiliency-after-import-script.sh.in index 32374503b..a46979da9 100644 --- a/stack/erp5/instance-mariadb-resiliency-after-import-script.sh.in +++ b/stack/erp5/instance-mariadb-resiliency-after-import-script.sh.in @@ -23,7 +23,11 @@ update_executable='${update-mysql:output}' # Make sure mariadb is not already running if [ -e "$pid_file" ]; then - pid=$(cat "$pid_file") > /dev/null 2>&1 + pid=$(cat "$pid_file") + if [ $? -ne 0 ]; then + echo "Cannot read Mariadb pidfile, assuming running. Aborting." + exit 1 + fi if kill -0 "$pid"; then echo "Mariadb is already running with pid $pid. Aborting." exit 1 -- 2.30.9