Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-07-13 15:37:53 +03:00
parent 9cee7a058e
commit 9ae7a6f35e
1 changed files with 4 additions and 13 deletions

17
ssm
View File

@ -29,7 +29,7 @@ svc() {
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
"$@" & job_pid=$! "$@" & job_pid=$!
@ -386,7 +386,7 @@ main() {
} }
# Get the service config # Get the service config
source "$service_config" || die 7 "Failed to read the service config: $cfgdir/init.d/$service_name" source -- "$service_config" "${@:3}" || die 7 "Failed to read the service config: $cfgdir/init.d/$service_name"
# Legacy # Legacy
[[ "$service_args" ]] && service_command=( "${service_command[@]}" "${service_args[@]}" ) [[ "$service_args" ]] && service_command=( "${service_command[@]}" "${service_args[@]}" )
@ -442,10 +442,10 @@ main() {
fi fi
# Run the function # Run the function
"$2"; res=$?
case "$2" in case "$2" in
stop) stop)
stop; res=$?
result "$res" \ result "$res" \
0 "Stopped $service_name" \ 0 "Stopped $service_name" \
3 "$service_name is not running" \ 3 "$service_name is not running" \
@ -453,8 +453,6 @@ main() {
;; ;;
start) start)
start; res=$?
result "$res" \ result "$res" \
0 "Started $service_name" \ 0 "Started $service_name" \
3 "$service_name is already running" \ 3 "$service_name is already running" \
@ -465,15 +463,11 @@ main() {
;; ;;
reload) reload)
reload; res=$?
result "$res" \ result "$res" \
0 "Reloaded $service_name" 0 "Reloaded $service_name"
;; ;;
status) status)
status; res=$?
if (( service_oneshot )); then if (( service_oneshot )); then
result "$res" \ result "$res" \
0 "$service_name is enabled" \ 0 "$service_name is enabled" \
@ -484,9 +478,6 @@ main() {
1 "$service_name is not running" 1 "$service_name is not running"
fi fi
;; ;;
*)
"$2"; res=$?;;
esac esac
(( res )) && return "$res" (( res )) && return "$res"