diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-06-01 23:17:53 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-06-04 01:52:10 (EDT) |
commit | 063ebb3618b2a426e4670d7bea337a56202cd53c (patch) | |
tree | d78a877af0ef8bce714754d85de99f657f28582c | |
parent | 09655210344e117917a2e32610b42144dc5518ef (diff) | |
download | homerc-063ebb3618b2a426e4670d7bea337a56202cd53c.zip homerc-063ebb3618b2a426e4670d7bea337a56202cd53c.tar.gz homerc-063ebb3618b2a426e4670d7bea337a56202cd53c.tar.bz2 |
bin/svc: Change PID dir, fix newlines on empty cmd output
-rwxr-xr-x | bin/svc | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -30,7 +30,7 @@ load_service() XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}" XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}" XDG_CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}" - PIDDIR="${XDG_CACHE_HOME}/homerc" + PIDDIR="${XDG_CACHE_HOME}/homerc/run" # Default functions stop() { :; } @@ -55,6 +55,9 @@ log() case "${action}" in 'start' | 'stop' | 'restart') eval "printf \"\\r\${msg_${action}${var}}\" \"\${service}\"" + case "${var}" in ?*) + printf '\n' + esac esac return 0 @@ -71,16 +74,14 @@ act() if out="$("${action}" 2>&1)"; then log "${service}" "${action}" '_ok' - case "${out}" in - '') printf '\n';; - *) printf '\n%s\n' "${out}";; + case "${out}" in ?*) + printf '%s\n' "${out}" esac return 0 else log "${service}" "${action}" '_fail' - case "${out}" in - '') printf '\n';; - *) printf '\n%s\n' "${out}";; + case "${out}" in ?*) + printf '%s\n' "${out}" esac return 1 fi |