From 063ebb3618b2a426e4670d7bea337a56202cd53c Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 01 Jun 2018 23:17:53 -0400 Subject: bin/svc: Change PID dir, fix newlines on empty cmd output --- diff --git a/bin/svc b/bin/svc index 9d65ac3..e278a94 100755 --- a/bin/svc +++ b/bin/svc @@ -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 -- cgit v0.9.1