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

35
ssm
View File

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