svn commit: r255178 - head/usr.sbin/periodic

Jeremie Le Hen jlh at FreeBSD.org
Tue Sep 3 13:40:25 UTC 2013


Author: jlh
Date: Tue Sep  3 13:40:24 2013
New Revision: 255178
URL: http://svnweb.freebsd.org/changeset/base/255178

Log:
  Include the calling context in the mail subject, if any.
  
  More concretely, periodic security scripts defaults to being
  called from daily ones -- daily context -- so the mail subject
  will now be "${HOST} daily security run output" instead of
  "{HOST} security run output".
  
  If you switch the period of some security checks to weekly, you
  will receive another email "${HOST} weekly security run output".

Modified:
  head/usr.sbin/periodic/periodic.sh

Modified: head/usr.sbin/periodic/periodic.sh
==============================================================================
--- head/usr.sbin/periodic/periodic.sh	Tue Sep  3 13:38:41 2013	(r255177)
+++ head/usr.sbin/periodic/periodic.sh	Tue Sep  3 13:40:24 2013	(r255178)
@@ -21,7 +21,7 @@ output_pipe()
     case "$output" in
     /*) pipe="cat >>$output";;
     "") pipe=cat;;
-    *)  pipe="mail -E -s '$host ${1##*/} run output' $output";;
+    *)  pipe="mail -E -s '$host ${2}${2:+ }${1##*/} run output' $output";;
     esac
     eval $pipe
 }
@@ -53,12 +53,13 @@ if [ $1 != "LOCKED" ]; then
         case $? in
         0) ;;
         73) #EX_CANTCREATE
-            echo "can't create ${lockfile}" | output_pipe $arg
+            echo "can't create ${lockfile}" | \
+                output_pipe $arg "$PERIODIC"
             ret=1
             ;;
         75) #EX_TEMPFAIL
             echo "$host ${arg##*/} prior run still in progress" | \
-                output_pipe $arg
+                output_pipe $arg "$PERIODIC"
             ret=1
             ;;
         *)
@@ -76,6 +77,7 @@ shift
 arg=$1
 
 tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX`
+context="$PERIODIC"
 export PERIODIC="$arg${PERIODIC:+ }${PERIODIC}"
 
 # Execute each executable file in the directory list.  If the x bit is not
@@ -136,6 +138,6 @@ esac
         echo ""
         echo "-- End of $arg output --"
     fi
-} | output_pipe ${arg}
+} | output_pipe $arg "$context"
 
 rm -f $tmp_output


More information about the svn-src-all mailing list