From 304fcb16d4b788b0411986445e44e4fde7a68965 Mon Sep 17 00:00:00 2001 From: avigailo Date: Thu, 6 Nov 2025 10:31:13 +0200 Subject: [PATCH] fix image entrypoint sigterm --- build_system/docker/entry.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build_system/docker/entry.sh b/build_system/docker/entry.sh index 63c113f..167efb3 100644 --- a/build_system/docker/entry.sh +++ b/build_system/docker/entry.sh @@ -18,15 +18,18 @@ init= active_watchdog_pid= cleanup() { - # Stop watchdog process if running + local signal="$1" + echo "[$(date '+%Y-%m-%d %H:%M:%S')] Signal ${signal} was received, exiting gracefully..." >&2 if [ -n "${active_watchdog_pid}" ] && ps -p ${active_watchdog_pid} > /dev/null 2>&1; then kill -TERM ${active_watchdog_pid} 2>/dev/null || true wait ${active_watchdog_pid} 2>/dev/null || true fi + echo "Cleanup completed. Exiting now." >&2 exit 0 } -trap cleanup SIGTERM SIGINT +trap 'cleanup SIGTERM' SIGTERM +trap 'cleanup SIGINT' SIGINT if [ ! -f /nano-service-installers/$ORCHESTRATION_INSTALLATION_SCRIPT ]; then echo "Error: agent installation package doesn't exist."