aboutsummaryrefslogtreecommitdiffstats
path: root/cron-sh
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-08-25 19:41:46 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-08-25 19:41:46 +0000
commit1e4064ded31c320b1a5c8c1f9fbd23b5c3048b30 (patch)
tree13caaeb3227b180a95eabb8fdc8ec6447f946361 /cron-sh
parent6121b8567540bb1d1a31bbb3f67d31ad807682e7 (diff)
downloadmsec-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-xcron-sh/security.sh18
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
}