From owner-svn-src-head@freebsd.org Thu Apr 6 01:37:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8C45D31C4D; Thu, 6 Apr 2017 01:37:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4193359; Thu, 6 Apr 2017 01:37:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v361b39l080992; Thu, 6 Apr 2017 01:37:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v361b3Q5080989; Thu, 6 Apr 2017 01:37:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704060137.v361b3Q5080989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 6 Apr 2017 01:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316548 - in head/etc/periodic: daily monthly weekly X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2017 01:37:05 -0000 Author: asomers Date: Thu Apr 6 01:37:03 2017 New Revision: 316548 URL: https://svnweb.freebsd.org/changeset/base/316548 Log: 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 Modified: head/etc/periodic/daily/450.status-security head/etc/periodic/monthly/450.status-security head/etc/periodic/weekly/450.status-security Modified: head/etc/periodic/daily/450.status-security ============================================================================== --- head/etc/periodic/daily/450.status-security Thu Apr 6 01:35:42 2017 (r316547) +++ head/etc/periodic/daily/450.status-security Thu Apr 6 01:37:03 2017 (r316548) @@ -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 Modified: head/etc/periodic/monthly/450.status-security ============================================================================== --- head/etc/periodic/monthly/450.status-security Thu Apr 6 01:35:42 2017 (r316547) +++ head/etc/periodic/monthly/450.status-security Thu Apr 6 01:37:03 2017 (r316548) @@ -22,19 +22,25 @@ case "$monthly_status_security_enable" i esac export security_output="${monthly_status_security_output}" + rc=0 case "${monthly_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 Modified: head/etc/periodic/weekly/450.status-security ============================================================================== --- head/etc/periodic/weekly/450.status-security Thu Apr 6 01:35:42 2017 (r316547) +++ head/etc/periodic/weekly/450.status-security Thu Apr 6 01:37:03 2017 (r316548) @@ -22,19 +22,25 @@ case "$weekly_status_security_enable" in esac export security_output="${weekly_status_security_output}" + rc=0 case "${weekly_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