From 7e1a38e5a342c2e25a2f2ab8e32ef326ce9c0b6e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 3 Sep 2018 10:31:52 +0200 Subject: lib/load-configuration: check early for running mysqld, add a kill-switch /tmp/do-not-run-build-master --- lib/load-configuration | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/load-configuration') diff --git a/lib/load-configuration b/lib/load-configuration index 9199281..a2ba0e0 100755 --- a/lib/load-configuration +++ b/lib/load-configuration @@ -4,9 +4,6 @@ # shellcheck disable=SC2034 -# TODO: a global kill-switch would be nice to block all activity before -# a reboot - set -e export LANG=C @@ -33,6 +30,15 @@ fi if [ "$(hostname)" = 'buildmaster.archlinux32.org' ]; then i_am_the_master=true + # abort early if mysqld is not running or kill switch active + # ('/tmp/do-not-run-build-master') + if [ ! -S '/var/run/mysqld/mysqld.sock' ] || \ + [ -f '/tmp/do-not-run-build-master' ]; then + >&2 echo 'mysqld is not running or build master is on halt' + >&2 echo 'I will abort - whatever you try to do would probably fail anyway.' + exit 1 + fi + releng_directory="${work_dir}/repos/releng" else i_am_the_master=false -- cgit v1.2.3