Another oops

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2018-01-07 08:56:33 +03:00
parent 08b7d5631d
commit 3c6fb9796b

11
ssm
View File

@ -26,11 +26,10 @@ svc() {
declare job_pid declare job_pid
svc::cleanup() { svc::cleanup() {
kill -n "$service_stop_signal" "$job_pid" "${service_command_stop[@]}"
pid_wait "$job_pid" && { pid_wait "$job_pid"
rm -f "$svc_pidfile" "$service_ready_flag" rm -f "$svc_pidfile" "$service_ready_flag"
}
}; trap 'svc::cleanup' TERM }; trap 'svc::cleanup' TERM
"$@" & job_pid=$! "$@" & job_pid=$!
@ -281,7 +280,11 @@ stop() {
else else
(( service_running )) || return 3 (( service_running )) || return 3
if (( service_managed )); then
nullexec kill "$service_pid" || return 1
else
"${service_command_stop[@]}" || return 1 "${service_command_stop[@]}" || return 1
fi
pid_wait "$service_pid" || return 5 pid_wait "$service_pid" || return 5
> "$service_stopped_flag" > "$service_stopped_flag"
@ -425,6 +428,7 @@ main() {
} }
done done
[[ $service_config ]] || {
# Search for a systemd service too # Search for a systemd service too
for i in {/etc/systemd,/run/systemd,/lib/systemd,/usr/lib/systemd}/system/$1.service; do for i in {/etc/systemd,/run/systemd,/lib/systemd,/usr/lib/systemd}/system/$1.service; do
[[ -f "$i" ]] && { [[ -f "$i" ]] && {
@ -435,6 +439,7 @@ main() {
break break
} }
done done
}
fi fi
# Die if there is no service config file # Die if there is no service config file