From 33a21382557504c9458cfbd6b8b2eec12c39f5c8 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Mon, 30 Dec 2024 01:22:16 -0500 Subject: [PATCH] Log only when running from a terminal --- spam-ham-learn | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spam-ham-learn b/spam-ham-learn index 31f194a..4363030 100755 --- a/spam-ham-learn +++ b/spam-ham-learn @@ -27,7 +27,10 @@ readonly LOGFILE="${HOME}/spam-ham-learn.log" log() { - printf "I: %s\n" "$*" >> "${LOGFILE}" + if [ -t 1 ]; then + # Only print things if running from a terminal. + printf "I: %s\n" "$*" + fi } learn_spam() @@ -37,8 +40,10 @@ learn_spam() log "Entering learn_spam" if [ "${FORCE}" = "false" ]; then - log "--force detected; not using -ctime on find" + log "--force not detected; using -ctime on find" findargs=" -ctime +${SPAM_MIN_AGE} " + else + log "--force detected; not using -ctime on find" fi # Collecting the spam.