summaryrefslogtreecommitdiff
path: root/lib/load-configuration
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-11-23 11:41:42 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2019-11-23 11:41:42 +0100
commit8510c3276e98b7d6b4ddeddf099c013f088898f2 (patch)
treefd53a799f6e297413580b6a3bbb70883bea9e3ca /lib/load-configuration
parentf98b470d17ddc096d68b93b964a5e72b16d9a176 (diff)
downloadbuilder-8510c3276e98b7d6b4ddeddf099c013f088898f2.tar.xz
implemented a stop build slave switch for running in a restartable systemd service
Diffstat (limited to 'lib/load-configuration')
-rwxr-xr-xlib/load-configuration14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/load-configuration b/lib/load-configuration
index b6756c1..a6db76e 100755
--- a/lib/load-configuration
+++ b/lib/load-configuration
@@ -28,6 +28,20 @@ if [ "$(hostname)" = 'buildmaster.archlinux32.org' ]; then
fi
else
i_am_the_master=false
+
+ # abort early or kill switch for slave in service (gracefull stop)
+ # is active. Remove the kill switch and return non-zero exit state,
+ # effectively making systemd not restart the service
+
+ if [ -f '/tmp/do-not-run-build-slave' ]; then
+ >&2 echo "Build slave stop switch is ative.. I'll stop now."
+ # When the buildslave is on "stop-now",
+ # - systemd 'Restart' expects non-zero exit code
+ # - interactively run commands SHOULD get exit code 1, too
+ # - remove the switch file, so we can start the service again
+ [ -f '/tmp/do-not-run-build-slave' ] && rm '/tmp/do-not-run-build-slave'
+ exit 1
+ fi
fi
# dirty hack to get this stuff debugable from a bash