Date: Fri, 4 Nov 2005 11:54:02 +0100 (CET) From: Dominik Brettnacher <domi@saargate.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/88486: [patch] make periodic(8) quiet (configurable) when no output was generated Message-ID: <200511041054.jA4As2xu000876@debussy.saargate.de> Resent-Message-ID: <200511041240.jA4CeCMM036357@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 88486 >Category: bin >Synopsis: [patch] make periodic(8) quiet (configurable) when no output was generated >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Nov 04 12:40:12 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Dominik Brettnacher >Release: FreeBSD 5.4-RELEASE i386 >Organization: >Environment: System: FreeBSD debussy.saargate.de 5.4-RELEASE FreeBSD 5.4-RELEASE #4: Tue Aug 23 12:00:38 CEST 2005 domi@debussy.saargate.de:/usr/obj/usr/src/sys/DEBUSSY i386 >Description: By default, periodic(8) outputs a notification like "No output from the x files processed" if the scripts executed did not generate any output. While this is useful to know whether the scripts have been executed at all, notifications like these are too verbose in certain environments. The attached patch introduces a new option "<basedir>_show_empty_output" to make this configurable. Setting it to YES (the default) results in the known behaviour. Setting it to NO means that no output (and thus no mail, if periodic output is sent out via mail) is generated. >How-To-Repeat: >Fix: --- /usr/sbin/periodic Thu Apr 3 10:55:30 2003 +++ periodic Mon Oct 31 17:13:39 2005 @@ -40,11 +40,11 @@ case "$output" in /*) pipe="cat >>$output";; "") pipe=cat;; - *) pipe="mail -s '$host ${arg##*/} run output' $output";; + *) pipe="mail -E -s '$host ${arg##*/} run output' $output";; esac - success=YES info=YES badconfig=NO # Defaults when ${run}_* aren't YES/NO - for var in success info badconfig + success=YES info=YES badconfig=NO empty_output=YES # Defaults when ${run}_* aren't YES/NO + for var in success info badconfig empty_output do case $(eval echo "\$${arg##*/}_show_$var") in [Yy][Ee][Ss]) eval $var=YES;; @@ -95,8 +95,11 @@ done if [ $empty = TRUE ] then - [ $processed = 1 ] && plural= || plural=s - echo "No output from the $processed file$plural processed" + if [ $empty_output = TRUE ] + then + [ $processed = 1 ] && plural= || plural=s + echo "No output from the $processed file$plural processed" + fi else echo "" echo "-- End of $arg output --" >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511041054.jA4As2xu000876>