commit fdd525a4ed7125af54dec8e4447ec069a2cd7e97 parent f0d24120581a80dc6e38c52bf757a517b1d8a07c Author: Morel BĂ©renger <berenger.morel@neutralite.org> Date: Thu, 14 Nov 2019 15:35:16 +0100 Improved automatic log behavior If there is no log daemon: * no longer try to rotate logs; * no longer redirect stderr to stdout; Diffstat:
M | etc/runit/common | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/etc/runit/common b/etc/runit/common @@ -1,6 +1,7 @@ #!/bin/sh -exec 2>&1 +HAS_LOG="$(test -d "$SVNAME/log" && printf "yes")" +test "yes" = "$HAS_LOG" && exec 2>&1 exec 0<&- set -x @@ -15,4 +16,6 @@ then AUTO_ROTATE=${AUTO_ROTATE:-"no"} fi -test "yes" = ${AUTO_ROTATE:-"yes"} && sv alarm "$SVNAME/log" +test "yes" = "${AUTO_ROTATE:-$HAS_LOG}" && + test "yes" = "$HAS_LOG" && + sv alarm "$SVNAME/log"