Guard against conflicts in Systemd's shutdown orchestration

This commit is contained in:
Tobias Kussel
2026-10-09 11:43:25 +02:00
parent 71138b6494
commit d50b66fe76
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -127,6 +127,11 @@ case "$ACTION" in
exec $COMPOSE -p $PROJECT -f ./minimal/docker-compose.yml -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit exec $COMPOSE -p $PROJECT -f ./minimal/docker-compose.yml -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
;; ;;
stop) stop)
# INVOCATION_ID is set by Systemd, so manual commands and Systemd's orchestration does not interfer
if [ -z "${INVOCATION_ID:-}" ] && systemctl is-active --quiet "bridgehead@$PROJECT"; then
log ERROR "bridgehead@$PROJECT is managed by systemd. Stop it with: sudo systemctl stop bridgehead@$PROJECT"
exit 1
fi
loadVars loadVars
# Kill stale secret-sync instances if present # Kill stale secret-sync instances if present
docker kill $(docker ps -q --filter ancestor=docker.verbis.dkfz.de/cache/samply/secret-sync-local) 2>/dev/null || true docker kill $(docker ps -q --filter ancestor=docker.verbis.dkfz.de/cache/samply/secret-sync-local) 2>/dev/null || true
+4 -1
View File
@@ -8,7 +8,10 @@ Restart=always
RestartSec=30 RestartSec=30
ExecStartPre=-/srv/docker/bridgehead/bridgehead preRun %i ExecStartPre=-/srv/docker/bridgehead/bridgehead preRun %i
ExecStart=/srv/docker/bridgehead/bridgehead start %i ExecStart=/srv/docker/bridgehead/bridgehead start %i
ExecStop=/srv/docker/bridgehead/bridgehead stop %i SuccessExitStatus=130
TimeoutStopSec=120
# Clean up containers after stop
ExecStopPost=-/srv/docker/bridgehead/bridgehead stop %i
ExecStopPost=-/srv/docker/bridgehead/bridgehead postRun %i ExecStopPost=-/srv/docker/bridgehead/bridgehead postRun %i
[Install] [Install]