From 11d7d92326dedd30b5a9392f46ab4a11b50820cd Mon Sep 17 00:00:00 2001 From: fbt Date: Sun, 29 Nov 2026 10:03:25 +0000 Subject: [PATCH] fail if the setup function fucks up Signed-off-by: fbt --- ssm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ssm b/ssm index 2e36eeb..14693b8 100755 --- a/ssm +++ b/ssm @@ -222,7 +222,11 @@ svc() { fi # Some setup might be required on each loop - run_service_action 'setup' + run_service_action 'setup' || { + printf 'Setup function failed, bailing!\n' >&2 + job_exit=127 + break + } # Spawn the process and record the PID spawn "$@" & job_pid = "$!" @@ -233,7 +237,7 @@ svc() { # We need to wait for the service to write down its pidfile until service_pidfile is file; do (( counter >= service_pidfile_timeout*10 )) && { - printf 'Timed out waiting for pidfile: %s' "$service_pidfile" >&2 + printf 'Timed out waiting for pidfile: %s\n' "$service_pidfile" >&2 job_exit=127 break } @@ -253,7 +257,7 @@ svc() { # Fail if the pid doesn't look right printf -v _ '%d' "$job_pid" || { - printf 'Job PID in %s seems to be malformed' "$service_pidfile" >&2 + printf 'Job PID in %s seems to be malformed\n' "$service_pidfile" >&2 job_exit=127 break }