From 1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30 Mon Sep 17 00:00:00 2001 From: Frederic Lepied Date: Sun, 25 Aug 2002 19:41:46 +0000 Subject: implement MAIL_EMPTY_CONTENT --- cron-sh/security.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cron-sh/security.sh b/cron-sh/security.sh index f0b6124..a846b41 100755 --- a/cron-sh/security.sh +++ b/cron-sh/security.sh @@ -203,13 +203,27 @@ Ttylog() { Maillog() { subject=${1} text=${2} - + SOMETHING_TO_SEND= + if [[ ${MAIL_WARN} == yes ]]; then if [[ -z ${MAIL_USER} ]]; then MAIL_USER="root" fi if [[ -x /bin/mail ]]; then - cat ${text} | /bin/mail -s "${subject}" "${MAIL_USER}" + for f in ${text}; do + if [[ -s $f ]]; then + SOMETHING_TO_SEND=1 + break + fi + done + if [[ -z ${SOMETHING_TO_SEND} ]]; then + if [[ ${MAIL_EMPTY_CONTENT} != no ]]; then + /bin/mail -s "${subject}" "${MAIL_USER}" <