diff --git a/ssm b/ssm index 282c173..3f5b9d0 100755 --- a/ssm +++ b/ssm @@ -165,6 +165,9 @@ svc() { job_exit = 0 # Exit successfully by default svc::cleanup() { + nullexec "${service_stop_command[@]}" + anywait "$job_pid" "$service_stop_timeout" + # Cgroup stuff, experimental and pretty much deprecated. if cgroups; then if service_cgroup_cleanup; then @@ -193,13 +196,7 @@ svc() { # Die die "$job_exit" - }; trap 'svc::cleanup' EXIT - - svc::stop_job() { - nullexec "${service_stop_command[@]}" - - anywait "$job_pid" "$service_stop_timeout" - }; trap 'svc::stop_job' TERM + }; trap 'svc::cleanup' TERM EXIT printf '%s' "$BASHPID" > "$svc_pidfile"