From: Ian Kelling Date: Wed, 9 Oct 2024 05:48:25 +0000 (-0400) Subject: use world readable log dir if running as root X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;p=log-quiet use world readable log dir if running as root --- diff --git a/sysd-mail-once b/sysd-mail-once index 2c9d026..a3eb11d 100755 --- a/sysd-mail-once +++ b/sysd-mail-once @@ -26,8 +26,13 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR errors=3 -tmp=(~) -cbase="${tmp[0]}/sysd-mail-once-state" +if [[ $EUID == 0 ]]; then + cbase=/var/local/sysd-mail-once +else + # (~) note: will work even if HOME is not set. + tmp=(~) + cbase="${tmp[0]}/sysd-mail-once-state" +fi to=root dryrun=false print_all=false