summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. 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)
commitfa2f1a55f682cc3b39f493416770c1a581b7992a (patch)
treebe5c930fec8ca0efa7170efc4046a42bea60b439
parent9520b945203d830bc32885a8187296825ab38747 (diff)
downloadhomerc-fa2f1a55f682cc3b39f493416770c1a581b7992a.zip
homerc-fa2f1a55f682cc3b39f493416770c1a581b7992a.tar.gz
homerc-fa2f1a55f682cc3b39f493416770c1a581b7992a.tar.bz2
bin/svc: Print service output after action message
-rwxr-xr-xbin/svc14
1 files changed, 10 insertions, 4 deletions
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
}