DragonFly BSD
DragonFly submit List (threaded) for 2009-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: proposed periodic patch


From: Joe Talbott <josepht@xxxxxxxxxxxxxxxx>
Date: Wed, 9 Dec 2009 12:26:12 -0500
Mail-followup-to: "submit@crater.dragonflybsd.org" <submit@crater.dragonflybsd.org>

On Wed, Dec 09, 2009 at 11:36:28AM -0500, Joe Talbott wrote:
> Hey guys,
> 
> I propose the following patch to periodic which will, by default,
> remove the verbose Start/Stop lines from periodic output which is
> emailed.  These lines will remain, by default, for logged output.
> This behavior can be controlled in periodic.conf with
> <dir>_show_verbose.
> 
> If no one objects vehemently I will commit this in a couple of days.
> 

A minor update to quote $verbose checks.

Joe
diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh
index 583c27a..7893df9 100644
--- a/usr.sbin/periodic/periodic.sh
+++ b/usr.sbin/periodic/periodic.sh
@@ -39,13 +39,19 @@ do
     # Where's our output going ?
     eval output=\$${arg##*/}_output
     case "$output" in
-    /*) pipe="cat >>$output";;
-    "") pipe=cat;;
-    *)  pipe="mail -s '$host ${arg##*/} run output' $output";;
+    /*) pipe="cat >>$output"
+        verbose=YES
+        ;;
+    "") pipe=cat
+        verbose=YES
+        ;;
+    *)  pipe="mail -s '$host ${arg##*/} run output' $output"
+        verbose=NO
+        ;;
     esac
 
     success=YES info=YES badconfig=NO	# Defaults when ${run}_* aren't YES/NO
-    for var in success info badconfig
+    for var in success info badconfig verbose
     do
         case $(eval echo "\$${arg##*/}_show_$var") in
         [Yy][Ee][Ss]) eval $var=YES;;
@@ -71,7 +77,10 @@ do
     {
         empty=TRUE
         processed=0
-        echo "-- Start of $arg output -- `date`"
+        if [ "$verbose" = YES ]
+        then
+            echo "-- Start of $arg output -- `date`"
+        fi
         for dir in $dirlist
         do
             for file in $dir/*
@@ -79,7 +88,10 @@ do
                 if [ -x $file -a ! -d $file ]
                 then
                     output=TRUE
-                    echo "-- Start of $arg $file output -- `date`"
+                    if [ "$verbose" = YES ]
+                    then
+                        echo "-- Start of $arg $file output -- `date`"
+                    fi
                     processed=$(($processed + 1))
                     $file </dev/null >$tmp_output 2>&1
                     rc=$?
@@ -101,8 +113,11 @@ do
           [ $processed = 1 ] && plural= || plural=s
           echo "No output from the $processed file$plural processed"
         else
-          echo ""
-          echo "-- End of $arg output -- `date`"
+          if [ "$verbose" = YES ]
+          then
+            echo ""
+            echo "-- End of $arg output -- `date`"
+          fi
         fi
     } | eval $pipe
 done


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]