refined info a bit

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2017-03-11 17:57:16 +03:00
parent 1394e52057
commit 532f7b0d09

35
ssm
View File

@ -256,14 +256,35 @@ super_stop() {
}
info() {
declare info=()
declare \
_status_label='Running' \
_status='no'
_type='daemon'
_info_items=()
printf "%12s: %s\n" \
"Name" "$service_name" \
"Exec" "$service_command ${service_args[*]}" \
"Respawn" "${service_respawn:-false}" \
"PIDfile" "${service_pidfile:-none}" \
(( service_oneshot )) && {
_status_label='Enabled'
_type='oneshot'
}
status && _status='yes'
_info_items=(
"Name" "$service_name"
"Type" "$_type"
"$_status_label" "$_status"
"Exec" "$service_command ${service_args[*]}"
"Respawn" "${service_respawn:-false}"
)
[[ "$_status" == 'yes' ]] && {
_info_items+=(
"PIDfile" "${service_pidfile:-none}"
"PID" "${service_pid:-none}"
)
}
printf "%12s: %s\n" "${_info_items[@]}"
}
result() {
@ -291,7 +312,7 @@ restart() {
"$0" "$service_name" start
}
logs() { cat "$service_logfile"; }
logs() { "${PAGER:-less}" "$service_logfile"; }
## Status is a bit of a special case. It's talkative.
status() {