From fa2f1a55f682cc3b39f493416770c1a581b7992a Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 01 Jun 2018 17:18:18 -0400 Subject: bin/svc: Print service output after action message --- diff --git a/bin/svc b/bin/svc index df12e4a..e97e915 100755 --- a/bin/svc +++ b/bin/svc @@ -56,9 +56,6 @@ log() case "${action}" in 'start' | 'stop' | 'restart') eval "printf \"\\r\${msg_${action}${var}}\" \"\${service}\"" esac - case "${var}" in ?*) - printf '\n' - esac return 0 } @@ -68,16 +65,25 @@ act() local service="${1}" local action="${2}" shift 2 + local out= local es= log "${service}" "${action}" '' - if "${action}"; then + if out="$("${action}" 2>&1)"; then log "${service}" "${action}" '_ok' + case "${out}" in + '') printf '\n';; + *) printf '\n%s\n' "${out}";; + esac return 0 else es=${?} log "${service}" "${action}" '_fail' + case "${out}" in + '') printf '\n';; + *) printf '\n%s\n' "${out}";; + esac return ${es} fi } -- cgit v0.9.1