diff options
author | Alan Somers <asomers@FreeBSD.org> | 2017-04-06 01:37:03 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2017-04-06 01:37:03 +0000 |
commit | e2a212c1fbbe4b9a54dc7893b0cd363da5e3b319 (patch) | |
tree | 006b7b1d02e1f64d57fe80c43af63164ba3508d7 /etc/periodic/daily | |
parent | 2d6ab41dcd57f1020a0c6b19709f52a9043b75f2 (diff) | |
download | src-e2a212c1fbbe4b9a54dc7893b0cd363da5e3b319.tar.gz src-e2a212c1fbbe4b9a54dc7893b0cd363da5e3b319.zip |
Quiet 450.status-security when *_inline="YES"
Previously, 450.status-security would always set rc=3 in inline mode,
because it doesn't know whether "periodic security" is going to find
anything interesting. But this annoyingly results in daily reports that
simply say "Security check: \n\n-- End of daily output --".
This change fixes that by testing whether "periodic security" printed
anything, and setting 450.status-security's exit status to 3 if it did. An
alternative would be to change the exit status of periodic(8) to be the
worst of its scripts' exit statuses, but that would be a more intrusive
change.
Reviewed by: brian
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D10267
Notes
Notes:
svn path=/head/; revision=316548
Diffstat (limited to 'etc/periodic/daily')
-rwxr-xr-x | etc/periodic/daily/450.status-security | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/etc/periodic/daily/450.status-security b/etc/periodic/daily/450.status-security index 38a1c3c9e909..31b6d4cf524e 100755 --- a/etc/periodic/daily/450.status-security +++ b/etc/periodic/daily/450.status-security @@ -22,19 +22,25 @@ case "$daily_status_security_enable" in esac export security_output="${daily_status_security_output}" + rc=0 case "${daily_status_security_output}" in "") - rc=3;; + if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX` + then + periodic security > $tempfile || rc=3 + if [ -s "$tempfile" ]; then + cat "$tempfile" + rc=3 + fi + rm -f "$tempfile" + fi;; /*) echo " (output logged separately)" - rc=0;; + periodic security || rc=3;; *) echo " (output mailed separately)" - rc=0;; - esac - - periodic security || rc=3;; - + periodic security || rc=3;; + esac;; *) rc=0;; esac |