diff --git a/ssm b/ssm index 5a628bb..4b3dbab 100755 --- a/ssm +++ b/ssm @@ -265,10 +265,12 @@ svc() { anywait "$job_pid"; job_exit=127 else printf '%s' "$job_pid" > "$service_pidfile" - wait "$job_pid"; job_exit=$? fi + # Record the job exit code + printf '%d' "$job_exit" > "$service_exit_file" + # One service failure, two service failures... if service_success_exit u "$job_exit"; then job_success = 1 @@ -300,8 +302,6 @@ svc() { # Sleep a bit between restarts sleep "$service_respawn_delay" done - - #svc::cleanup }; readonly -f svc ## Run a command with its output discarded