From 8d7f4d77c6eab1163da3dd9bd89c96038cbd158e Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 10 May 2023 13:56:10 -0400 Subject: [PATCH] sycam sysd-mail-once: slightly more verbose, plus dry run --- sysd-mail-once | 104 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 24 deletions(-) diff --git a/sysd-mail-once b/sysd-mail-once index 3b87eea..3542200 100755 --- a/sysd-mail-once +++ b/sysd-mail-once @@ -20,9 +20,11 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR errors=3 cbase=$HOME/sysd-mail-once-state to=root -case "$1" in - -h|--help) - cat <$file + if $dryrun; then + printf "dryrun: creating $file, contents: %s\n" "$cursor" + else + printf "%s\n" "$cursor" >$file + fi if (( errors == 1 )); then send_mail=true fi fi if $send_mail; then - exim -odf -t <= $errors errors." + mi exim -odf -t <