diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-06-01 17:18:18 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-06-03 23:44:41 (EDT) |
commit | fa2f1a55f682cc3b39f493416770c1a581b7992a (patch) | |
tree | be5c930fec8ca0efa7170efc4046a42bea60b439 /bin/svc | |
parent | 9520b945203d830bc32885a8187296825ab38747 (diff) | |
download | homerc-fa2f1a55f682cc3b39f493416770c1a581b7992a.zip homerc-fa2f1a55f682cc3b39f493416770c1a581b7992a.tar.gz homerc-fa2f1a55f682cc3b39f493416770c1a581b7992a.tar.bz2 |
bin/svc: Print service output after action message
Diffstat (limited to 'bin/svc')
-rwxr-xr-x | bin/svc | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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 } |