summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2007-06-22 10:04:05 +0000
committerdwmalone <dwmalone@FreeBSD.org>2007-06-22 10:04:05 +0000
commit35e07e1a73d48b9ab13a630c8e5447aeb4e222f5 (patch)
tree6e37466aa70c2a668e23bba0f0897b16fa6e727c
parentda3cb47a62e810c3b8c2633e20cf76eef04c30d2 (diff)
downloadFreeBSD-src-35e07e1a73d48b9ab13a630c8e5447aeb4e222f5.zip
FreeBSD-src-35e07e1a73d48b9ab13a630c8e5447aeb4e222f5.tar.gz
Add an option to make periodic(8) quiet when no output was generated.
The man page part of the patch is my fault, the changes to the periodic script is Dominik's. PR: 88486 Submitted by: Dominik Brettnacher <domi@saargate.de> Reviewed by: brian Approved by: re MFC after: 1 month
-rw-r--r--usr.sbin/periodic/periodic.85
-rw-r--r--usr.sbin/periodic/periodic.sh13
2 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/periodic/periodic.8 b/usr.sbin/periodic/periodic.8
index 4e9b676..569da04 100644
--- a/usr.sbin/periodic/periodic.8
+++ b/usr.sbin/periodic/periodic.8
@@ -135,6 +135,11 @@ value does not begin with a
.Ql /
and is not empty, it is assumed to contain a list of email addresses, and
the output is mailed to them.
+If
+.Ao Ar basedir Ac Ns Va _show_empty_output
+is set to
+.Dq Li NO ,
+then no mail will be sent if the output was empty.
.Pp
If
.Ao Ar basedir Ac Ns Va _output
diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh
index 73e8576..ca954ea 100644
--- a/usr.sbin/periodic/periodic.sh
+++ b/usr.sbin/periodic/periodic.sh
@@ -40,11 +40,11 @@ do
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 @@ do
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 --"
OpenPOWER on IntegriCloud