diff options
author | Frederic Lepied <flepied@mandriva.com> | 2002-08-25 19:41:46 +0000 |
---|---|---|
committer | Frederic Lepied <flepied@mandriva.com> | 2002-08-25 19:41:46 +0000 |
commit | 1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30 (patch) | |
tree | 13caaeb3227b180a95eabb8fdc8ec6447f946361 /cron-sh | |
parent | 6121b8567540bb1d1a31bbb3f67d31ad807682e7 (diff) | |
download | msec-1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30.tar msec-1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30.tar.gz msec-1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30.tar.bz2 msec-1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30.tar.xz msec-1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30.zip |
implement MAIL_EMPTY_CONTENT
Diffstat (limited to 'cron-sh')
-rwxr-xr-x | cron-sh/security.sh | 18 |
1 files 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}" <<EOF +Nothing has changed since the last run. +EOF + else + cat ${text} | /bin/mail -s "${subject}" "${MAIL_USER}" + fi fi fi } |