Log only when running from a terminal

This commit is contained in:
Sergio Durigan Junior 2024-12-30 01:22:16 -05:00
parent eac91c85e5
commit 33a2138255
Signed by: sergiodj
GPG key ID: D0EB762865FC5E36

View file

@ -27,7 +27,10 @@ readonly LOGFILE="${HOME}/spam-ham-learn.log"
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() learn_spam()
@ -37,8 +40,10 @@ learn_spam()
log "Entering learn_spam" log "Entering learn_spam"
if [ "${FORCE}" = "false" ]; then 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} " findargs=" -ctime +${SPAM_MIN_AGE} "
else
log "--force detected; not using -ctime on find"
fi fi
# Collecting the spam. # Collecting the spam.