Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Sep 2000 11:24:13 +0200 (CEST)
From:      clefevre@citeweb.net (Cyrille Lefevre)
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/21444: periodic conditional verbosity
Message-ID:  <200009210924.e8L9ODh01744@gits.dyndns.org>

next in thread | raw e-mail | index | archive | help

>Number:         21444
>Category:       bin
>Synopsis:       periodic conditional verbosity
>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:   Thu Sep 21 02:30:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
ACME
>Environment:

FreeBSD gits 4.1-STABLE FreeBSD 4.1-STABLE #2: Wed Sep 20 07:12:10 CEST 2000     root@gits:/disk2/4.0-stable/src/sys/compile/CUSTOM  i386

>Description:

	this patch to periodic files conditionally print the topic 
	line only if there is any outputs to shorten periodic reports.

	this feature is configurable by the periodic_always_print_message
	variable. the default value works as before which is to always
	print topic lines.

	all "echo" in periodic files have been changed this way even if
	there is always some outputs just to be consistent with other files.

>How-To-Repeat:

	n/a

>Fix:


Index: usr.sbin/periodic/periodic.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/periodic/periodic.sh,v
retrieving revision 1.9.2.3
diff -u -r1.9.2.3 periodic.sh
--- usr.sbin/periodic/periodic.sh	2000/08/08 18:05:42	1.9.2.3
+++ usr.sbin/periodic/periodic.sh	2000/09/19 23:48:01
@@ -52,7 +52,6 @@
 
 host=`hostname`
 export host
-echo "Subject: $host $run run output"
 
 # Execute each executable file in the directory list.  If the x bit is not
 # set, assume the user didn't really want us to muck with it (it's a
@@ -64,4 +63,4 @@
 	    $file
 	fi
     done
-done
+done | periodic_maybe_print_message -0 "Subject: $host $run run output"
Index: etc/defaults/periodic.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/periodic.conf,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 periodic.conf
--- etc/defaults/periodic.conf	2000/08/08 18:05:35	1.7.2.1
+++ etc/defaults/periodic.conf	2000/09/19 23:29:21
@@ -19,7 +19,10 @@
 # periodic script dirs
 local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic"
 
+# whether or not to "always" print the subject (or topic) line
+periodic_always_print_message="YES"
 
+
 # Daily options
 
 # 100.clean-disks
@@ -168,5 +171,64 @@
                                 ;;
                         esac
                 done
+        }
+fi
+
+
+# Define periodic_maybe_print_subject, the function used by /etc/periodic/*/*
+# scripts to print the subject (or topic) line only (or always) if there
+# is any output.
+
+if [ -z "${periodic_print_message_defined}" ]; then
+        periodic_print_message_defined=yes
+        periodic_print_message () {
+		local n=2 message
+
+		case $1 in
+		-[0-9]) n=${1#-}
+			shift ;;
+		esac
+
+		message="$*"
+
+		while [ $n -gt 0 ]; do
+			echo ""
+			n=$(($n-1))
+		done
+
+		echo "${message}"
+		echo ""
+        }
+fi
+
+if [ -z "${periodic_maybe_print_message_defined}" ]; then
+        periodic_maybe_print_message_defined=yes
+        periodic_maybe_print_message () {
+		local n=2 message
+
+		case $1 in
+		-[0-9]) n=${1#-}
+			shift ;;
+		esac
+
+		message="$*"
+
+		case ${periodic_always_print_message} in
+		[Yy][Ee][Ss])
+			periodic_print_message -$n "${message}"
+			cat
+			;;
+		*)
+			awk -v n=$n -v message="${message}" '
+			/./ && !flag {
+				flag=1
+				while (n-- > 0)
+					print ""
+				print message "\n"
+			}
+			flag
+			'
+			;;
+		esac
         }
 fi
Index: etc/security
===================================================================
RCS file: /home/ncvs/src/etc/security,v
retrieving revision 1.36.2.5
diff -u -r1.36.2.5 security
--- etc/security	2000/08/08 18:05:26	1.36.2.5
+++ etc/security	2000/09/19 23:49:18
@@ -6,10 +6,10 @@
 PATH=/sbin:/bin:/usr/bin
 LC_ALL=C; export LC_ALL
 
-separator () {
-	echo ''
-	echo ''
-}
+if [ -r /etc/defaults/periodic.conf ]; then
+    . /etc/defaults/periodic.conf
+    source_periodic_confs
+fi
 
 sflag=FALSE ignore=
 while getopts ams c
@@ -24,15 +24,14 @@
 yesterday=`date -v-1d "+%b %e "`
 
 host=`hostname`
-[ $sflag = FALSE ] && echo "Subject: ${host} security check output"
+[ $sflag = FALSE ] &&
+periodic_print_message -0 "Subject: ${host} security check output"
 
 LOG=/var/log
 TMP=/var/run/_secure.$$
 
 umask 027
 
-echo "checking setuid files and devices:"
-
 # Don't have ncheck, but this does the equivalent of the commented out block.
 # Note that one of the original problems, the possibility of overrunning
 # the args to ls, is still here...
@@ -48,15 +47,13 @@
 done | xargs -0 -n 20 ls -liTd | sort +10 > ${TMP}
 
 if [ ! -f ${LOG}/setuid.today ]; then
-	separator
-	echo "no ${LOG}/setuid.today"
+	periodic_print_message "no ${LOG}/setuid.today"
 	cp ${TMP} ${LOG}/setuid.today
 fi
 
 if ! cmp ${LOG}/setuid.today ${TMP} >/dev/null; then
-	separator
-	echo "${host} setuid diffs:"
-	diff -w ${LOG}/setuid.today ${TMP}
+	diff -w ${LOG}/setuid.today ${TMP} |
+	periodic_maybe_print_message "${host} setuid diffs:"
 	mv ${LOG}/setuid.today ${LOG}/setuid.yesterday
 	mv ${TMP} ${LOG}/setuid.today
 fi
@@ -66,40 +63,35 @@
 [ -n "$ignore" ] && cmd="egrep -v ${ignore#|}" || cmd=cat
 if mount -p | $cmd > $TMP; then
 	if [ ! -f $LOG/mount.today ]; then
-		separator
-		echo "no $LOG/mount.today"
+		periodic_print_message "no $LOG/mount.today"
 		cp $TMP $LOG/mount.today
 	fi
+
 	if ! cmp $LOG/mount.today $TMP >/dev/null 2>&1; then
-		separator
-		echo "$host changes in mounted filesystems:"
-		diff -b $LOG/mount.today $TMP
+		diff -b $LOG/mount.today $TMP |
+		periodic_maybe_print_message "$host changes in mounted filesystems:"
 		mv $LOG/mount.today $LOG/mount.yesterday
 		mv $TMP $LOG/mount.today
 	fi
 fi
 
-separator
-echo "checking for uids of 0:"
-awk -F: '$3==0 {print $1,$3}' /etc/master.passwd
-
-separator
-echo "checking for passwordless accounts:"
-awk -F: 'NF > 1 && $1 !~ /^[#+-]/ && $2=="" {print $0}' /etc/master.passwd
+awk -F: '$3==0 {print $1,$3}' /etc/master.passwd |
+periodic_maybe_print_message "checking for uids of 0:"
 
+awk -F: 'NF > 1 && $1 !~ /^[#+-]/ && $2=="" {print $0}' /etc/master.passwd |
+periodic_maybe_print_message "checking for passwordless accounts:"
+
 # Show denied packets
 #
 if ipfw -a l 2>/dev/null | egrep "deny|reset|unreach" > ${TMP}; then
 	if [ ! -f ${LOG}/ipfw.today ]; then
-		separator
-		echo "no ${LOG}/ipfw.today"
+		periodic_print_message "no ${LOG}/ipfw.today"
 		cp ${TMP} ${LOG}/ipfw.today
 	fi
 
 	if ! cmp ${LOG}/ipfw.today ${TMP} >/dev/null; then
-		separator
-		echo "${host} denied packets:"
-		diff -b ${LOG}/ipfw.today ${TMP} | egrep "^>"
+		diff -b ${LOG}/ipfw.today ${TMP} | egrep "^>" |
+		periodic_maybe_print_message "${host} denied packets:"
 		mv ${LOG}/ipfw.today ${LOG}/ipfw.yesterday
 		mv ${TMP} ${LOG}/ipfw.today
 	fi
@@ -110,27 +102,21 @@
 IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null`
 if [ $? -eq 0 -a "${IPFW_LOG_LIMIT}" -ne 0 ]; then
 	ipfw -a l | grep " log " | perl -n -e \
-		'/^\d+\s+(\d+)/; print if ($1 >= '$IPFW_LOG_LIMIT')' > ${TMP}
-	if [ -s "${TMP}" ]; then
-		separator
-		echo "ipfw log limit reached:"
-		cat ${TMP}
-	fi
+		'/^\d+\s+(\d+)/; print if ($1 >= '$IPFW_LOG_LIMIT')' |
+	periodic_print_message "ipfw log limit reached:"
 fi
 
 # Show kernel log messages
 #
 if dmesg 2>/dev/null > ${TMP}; then
 	if [ ! -f ${LOG}/dmesg.today ]; then
-		separator
-		echo "no ${LOG}/dmesg.today"
+		periodic_print_message "no ${LOG}/dmesg.today"
 		cp ${TMP} ${LOG}/dmesg.today
 	fi
 
 	if ! cmp ${LOG}/dmesg.today ${TMP} >/dev/null 2>&1; then
-		separator
-		echo "${host} kernel log messages:"
-		diff -b ${LOG}/dmesg.today ${TMP} | egrep "^>"
+		diff -b ${LOG}/dmesg.today ${TMP} | egrep "^>" |
+		periodic_maybe_print_message "${host} kernel log messages:"
 		mv ${LOG}/dmesg.today ${LOG}/dmesg.yesterday
 		mv ${TMP} ${LOG}/dmesg.today
 	fi
@@ -138,14 +124,14 @@
 
 # Show login failures
 #
-separator
-echo "${host} login failures:"
-zcat -f $LOG/messages.0* $LOG/messages | grep -i "^$yesterday.*login failure"
+zcat -f $LOG/messages.0* $LOG/messages |
+grep -i "^$yesterday.*login failure" |
+periodic_maybe_print_message "${host} login failures:"
 
 # Show tcp_wrapper warning messages
 #
-separator
-echo "${host} refused connections:"
-zcat -f $LOG/messages.0* $LOG/messages | grep -i "^$yesterday.*refused connect"
+zcat -f $LOG/messages.0* $LOG/messages |
+grep -i "^$yesterday.*refused connect" |
+periodic_maybe_print_message "${host} refused connections:"
 
 rm -f ${TMP}
Index: etc/periodic/daily/100.clean-disks
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/100.clean-disks,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 100.clean-disks
--- etc/periodic/daily/100.clean-disks	2000/08/25 18:52:36	1.3.2.2
+++ etc/periodic/daily/100.clean-disks	2000/09/19 21:18:37
@@ -17,8 +17,6 @@
     [Yy][Ee][Ss])
 	if [ -n "$daily_clean_disks_days" -a -n "$daily_clean_disks_files" ]
 	then
-	    echo ""
-	    echo "Removing old temporary files:"
 	    set -f noglob
 	    args="$args "`echo " ${daily_clean_disks_files% }" |
 		sed 's/[ 	][ 	]*/ -name /g'`
@@ -33,5 +31,7 @@
 	    find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
 		\( $args \) -atime +$daily_clean_disks_days -delete $print
 	    set -f glob
-	fi;;
+	fi |
+	periodic_maybe_print_message "Removing old temporary files:"
+	;;
 esac
Index: etc/periodic/daily/110.clean-tmps
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/110.clean-tmps,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 110.clean-tmps
--- etc/periodic/daily/110.clean-tmps	2000/08/08 18:05:36	1.6.2.1
+++ etc/periodic/daily/110.clean-tmps	2000/09/19 21:18:57
@@ -18,9 +18,6 @@
     [Yy][Ee][Ss])
 	if [ -n "$daily_clean_tmps_days" ]
 	then
-	    echo ""
-	    echo "Removing old temporary files:"
-
 	    set -f noglob
 	    args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days"
 	    [ -n "$daily_clean_tmps_ignore" ] &&
@@ -42,5 +39,7 @@
 		} | sed "s,^\\.,  $dir,"
 	    done
 	    set -f glob
-	fi;;
+	fi |
+	periodic_maybe_print_message "Removing old temporary files:"
+	;;
 esac
Index: etc/periodic/daily/120.clean-preserve
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/120.clean-preserve,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 120.clean-preserve
--- etc/periodic/daily/120.clean-preserve	2000/08/08 18:05:36	1.4.2.1
+++ etc/periodic/daily/120.clean-preserve	2000/09/19 21:19:16
@@ -17,9 +17,6 @@
     [Yy][Ee][Ss])
 	if [ -n "$daily_clean_preserve_days" -a -d /var/preserve ]
 	then
-	    echo ""
-	    echo "Removing stale files from /var/preserve:"
-
 	    case "$daily_clean_preserve_verbose" in
 		[Yy][Ee][Ss])
 		    print=-print;;
@@ -30,5 +27,7 @@
 	    cd /var/preserve &&
 		find . ! -name . -mtime +$daily_clean_preserve_days \
 		    -delete $print
-	fi;;
+	fi |
+	periodic_maybe_print_message "Removing stale files from /var/preserve:"
+	;;
 esac
Index: etc/periodic/daily/130.clean-msgs
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/130.clean-msgs,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 130.clean-msgs
--- etc/periodic/daily/130.clean-msgs	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/130.clean-msgs	2000/09/19 21:19:33
@@ -17,11 +17,10 @@
     [Yy][Ee][Ss])
 	if [ -d /var/msgs ]
 	then
-	    echo ""
-	    echo "Cleaning out old system announcements:"
-
 	    [ -n "$daily_clean_msgs_days" ] &&
 		arg=-${daily_clean_msgs_days#-} || arg=
 	    msgs -c $arg
-	fi;;
+	fi |
+	periodic_maybe_print_message "Cleaning out old system announcements:"
+	;;
 esac
Index: etc/periodic/daily/140.clean-rwho
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/140.clean-rwho,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 140.clean-rwho
--- etc/periodic/daily/140.clean-rwho	2000/08/08 18:05:36	1.4.2.1
+++ etc/periodic/daily/140.clean-rwho	2000/09/19 21:19:51
@@ -17,9 +17,6 @@
     [Yy][Ee][Ss])
 	if [ -n "$daily_clean_rwho_days" -a -d /var/rwho ]
 	then
-	    echo ""
-	    echo "Removing stale files from /var/rwho:"
-
 	    case "$daily_clean_rwho_verbose" in
 		[Yy][Ee][Ss])
 		    print=-print;;
@@ -29,5 +26,7 @@
 
 	    cd /var/rwho &&
 		find . ! -name . -mtime +$daily_clean_rwho_days -delete $print
-	fi;;
+	fi |
+	periodic_maybe_print_message "Removing stale files from /var/rwho:"
+	;;
 esac
Index: etc/periodic/daily/150.clean-hoststat
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/150.clean-hoststat,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 150.clean-hoststat
--- etc/periodic/daily/150.clean-hoststat	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/150.clean-hoststat	2000/09/19 21:20:12
@@ -17,9 +17,6 @@
     [Yy][Ee][Ss])
 	if [ -n "$daily_clean_hoststat_days" -a -d /var/spool/.hoststat ]
 	then
-	    echo ""
-	    echo "Removing stale files from /var/spool/.hoststat:"
-
 	    case "$daily_clean_hoststat_verbose" in
 		[Yy][Ee][Ss])
 		    print=-print;;
@@ -30,5 +27,7 @@
 	    cd /var/hoststat &&
 		find . ! -name . -mtime +$daily_clean_hoststat_days \
 		    -delete $print
-	fi;;
+	fi |
+	periodic_maybe_print_message "Removing stale files from /var/spool/.hoststat:"
+	;;
 esac
Index: etc/periodic/daily/200.backup-passwd
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/200.backup-passwd,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 200.backup-passwd
--- etc/periodic/daily/200.backup-passwd	2000/08/08 18:05:36	1.6.2.1
+++ etc/periodic/daily/200.backup-passwd	2000/09/19 23:14:32
@@ -17,43 +17,41 @@
 	then
 	    bak=/var/backups
 
-	    echo ""
-	    echo "Backup passwd and group files:"
-
 	    if [ ! -f $bak/master.passwd.bak ]
 	    then
-		echo "no $bak/master.passwd.bak"
+		periodic_print_message -1 "no $bak/master.passwd.bak"
 		cp -p /etc/master.passwd $bak/master.passwd.bak
 	    fi
 
 	    if ! cmp -s $bak/master.passwd.bak /etc/master.passwd
 	    then
-		echo "$host passwd diffs:"
 		diff $bak/master.passwd.bak /etc/master.passwd |\
-			sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
+			sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/' |
+		periodic_maybe_print_message -1 "$host passwd diffs:"
 		mv $bak/master.passwd.bak $bak/master.passwd.bak2
 		cp -p /etc/master.passwd $bak/master.passwd.bak
 	    fi
 
 	    if [ ! -f $bak/group.bak ]
 	    then
-		echo "no $bak/group.bak"
+		periodic_print_message -1 "no $bak/group.bak"
 		cp -p /etc/group $bak/group.bak
 	    fi
 
 	    if ! cmp -s $bak/group.bak /etc/group
 	    then
-		echo "$host group diffs:"
-		diff $bak/group.bak /etc/group
+		diff $bak/group.bak /etc/group |
+		periodic_maybe_print_message -1 "$host group diffs:"
 		mv $bak/group.bak $bak/group.bak2
 		cp -p /etc/group $bak/group.bak
 	    fi
 
 	    if [ -f /etc/group ]
 	    then
-	        echo ""
-		echo "Verifying group file syntax:"
-	        chkgrp /etc/group
+	        chkgrp /etc/group |
+		periodic_maybe_print_message -1 "Verifying group file syntax:"
 	    fi
-	fi;;
+	fi |
+	periodic_maybe_print_message "Backup passwd and group files:"
+	;;
 esac
Index: etc/periodic/daily/210.backup-aliases
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/210.backup-aliases,v
retrieving revision 1.3.2.2
diff -u -r1.3.2.2 210.backup-aliases
--- etc/periodic/daily/210.backup-aliases	2000/08/27 17:31:38	1.3.2.2
+++ etc/periodic/daily/210.backup-aliases	2000/09/19 23:13:57
@@ -17,21 +17,20 @@
 	then
 	    bak=/var/backups
 
-	    echo ""
-	    echo "Backing up mail aliases:"
-
 	    if [ ! -f $bak/aliases.bak ]
 	    then
-		echo "no $bak/aliases.bak"
+		periodic_print_message -1 "no $bak/aliases.bak"
 		cp -p /etc/mail/aliases $bak/aliases.bak
 	    fi
 
 	    if ! cmp -s $bak/aliases.bak /etc/mail/aliases
 	    then
-		echo "$host aliases diffs:"
-		diff -u $bak/aliases.bak /etc/mail/aliases
+		diff -u $bak/aliases.bak /etc/mail/aliases |
+		periodic_maybe_print_message -1 "$host aliases diffs:"
 		mv $bak/aliases.bak $bak/aliases.bak2
 		cp -p /etc/mail/aliases $bak/aliases.bak
 	    fi
-	fi;;
+	fi |
+	periodic_maybe_print_message "Backing up mail aliases:"
+	;;
 esac
Index: etc/periodic/daily/220.backup-distfile
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/220.backup-distfile,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 220.backup-distfile
--- etc/periodic/daily/220.backup-distfile	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/220.backup-distfile	2000/09/19 23:14:56
@@ -17,13 +17,20 @@
 	then
 	    bak=/var/backups
 
-	    echo ""
-	    echo "Backing up /etc/Distfile:"
+            if [ ! -f $bak/Distfile.bak ]
+	    then
+		periodic_print_message -1 "no $bak/Distfile.bak"
+		cp -p /etc/Distfile $bak/Distfile.bak
+	    fi
 
 	    if ! cmp -s $bak/Distfile.bak /etc/Distfile
 	    then
+		diff $bak/Distfile.bak /etc/Distfile |
+		periodic_maybe_print_message -1 "$host Distfile diffs:"
 		mv $bak/Distfile.bak $bak/Distfile.bak2
-		cp /etc/Distfile $bak/Distfile.bak
+		cp -p /etc/Distfile $bak/Distfile.bak
 	    fi
-	fi;;
+	fi |
+	periodic_maybe_print_message "Backing up /etc/Distfile:"
+	;;
 esac
Index: etc/periodic/daily/300.calendar
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/300.calendar,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 300.calendar
--- etc/periodic/daily/300.calendar	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/300.calendar	2000/09/19 21:27:21
@@ -20,9 +20,7 @@
     [Yy][Ee][Ss])
 	if [ -f /usr/bin/calendar ]
 	then
-	    echo ""
-	    echo "Running calendar:"
-
 	    calendar -a
-	fi;;
+	fi |
+	periodic_maybe_print_message "Running calendar:"
 esac
Index: etc/periodic/daily/310.accounting
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/310.accounting,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 310.accounting
--- etc/periodic/daily/310.accounting	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/310.accounting	2000/09/19 22:36:37
@@ -15,9 +15,6 @@
     [Yy][Ee][Ss])
 	if [ -f /var/account/acct ]
 	then
-	    echo ""
-	    echo "Rotating accounting logs and gathering statistics:"
-
 	    cd /var/account
 
 	    rm -f acct.3.gz acct.3
@@ -34,5 +31,7 @@
 		[Yy][Ee][Ss])
 		    gzip -f acct.0;;
 	    esac
-	fi;;
+	fi |
+	periodic_maybe_print_message "Rotating accounting logs and gathering statistics:"
+	;;
 esac
Index: etc/periodic/daily/320.rdist
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/320.rdist,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 320.rdist
--- etc/periodic/daily/320.rdist	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/320.rdist	2000/09/19 22:22:37
@@ -15,9 +15,8 @@
     [Yy][Ee][Ss])
 	if [ -f /etc/Distfile ]
 	then
-	    echo ""
-	    echo "Running rdist with /etc/Distfile:"
-
 	    rdist -f /etc/Distfile
-	fi;;
+	fi |
+	periodic_maybe_print_message "Running rdist with /etc/Distfile:"
+	;;
 esac
Index: etc/periodic/daily/330.news
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/330.news,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 330.news
--- etc/periodic/daily/330.news	2000/08/08 18:05:36	1.2.2.1
+++ etc/periodic/daily/330.news	2000/09/19 22:23:01
@@ -18,9 +18,8 @@
     [Yy][Ee][Ss])
 	if [ -f /etc/news.expire ]
 	then
-	    echo ""
-	    echo "Running news.expire:"
-
 	    /etc/news.expire
-	fi;;
+	fi |
+	periodic_maybe_print_message "Running news.expire:"
+	;;
 esac
Index: etc/periodic/daily/340.uucp
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/340.uucp,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 340.uucp
--- etc/periodic/daily/340.uucp	2000/08/08 18:05:36	1.4.2.1
+++ etc/periodic/daily/340.uucp	2000/09/19 22:23:21
@@ -18,9 +18,8 @@
     [Yy][Ee][Ss])
 	if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]
 	then
-	    echo ""
-	    echo "Cleaning up UUCP:"
-
 	    echo /etc/uuclean.daily | su -m uucp
-	fi;;
+	fi |
+	periodic_maybe_print_message "Cleaning up UUCP:"
+	;;
 esac
Index: etc/periodic/daily/400.status-disks
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/400.status-disks,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 400.status-disks
--- etc/periodic/daily/400.status-disks	2000/08/08 18:05:36	1.2.2.1
+++ etc/periodic/daily/400.status-disks	2000/09/19 23:34:14
@@ -13,13 +13,11 @@
 
 case "$daily_status_disks_enable" in
     [Yy][Ee][Ss])
-	echo ""
-	echo "Disk status:"
+	df $daily_status_disks_df_flags |
+	periodic_maybe_print_message "Disk status:"
 
-	df $daily_status_disks_df_flags
-
 	# display which filesystems need backing up
 
-	echo ""
-	dump W;;
+	dump W |
+	periodic_maybe_print_message -1 "Backup status:"
 esac
Index: etc/periodic/daily/410.status-uucp
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/410.status-uucp,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 410.status-uucp
--- etc/periodic/daily/410.status-uucp	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/410.status-uucp	2000/09/19 22:24:19
@@ -15,9 +15,8 @@
     [Yy][Ee][Ss])
 	if [ -d /var/spool/uucp -a -x /usr/bin/uustat ]
 	then
-	    echo ""
-	    echo "UUCP status:"
-
 	    uustat -a
-	fi;;
+	fi |
+	periodic_maybe_print_message "UUCP status:"
+	;;
 esac
Index: etc/periodic/daily/420.status-network
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/420.status-network,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 420.status-network
--- etc/periodic/daily/420.status-network	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/420.status-network	2000/09/19 22:38:22
@@ -15,14 +15,13 @@
     [Yy][Ee][Ss])
 	if [ -x /usr/bin/netstat ]
 	then
-	    echo ""
-	    echo "Network interface status:"
-
 	    case "$daily_status_network_usedns" in
 		[Yy][Ee][Ss])
 		    netstat -i;;
 		*)
 		    netstat -in;;
 	    esac
-	fi;;
+	fi |
+	periodic_maybe_print_message "Network interface status:"
+	;;
 esac
Index: etc/periodic/daily/430.status-rwho
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/430.status-rwho,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 430.status-rwho
--- etc/periodic/daily/430.status-rwho	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/430.status-rwho	2000/09/19 22:25:54
@@ -16,12 +16,10 @@
 	rwho=$(echo /var/rwho/*)
         if [ -x /usr/bin/rwho -a -f "${rwho%% *}" ]
         then
-	    echo ""
-	    echo "Local network system status:"
-	    ruptime
+	    ruptime |
+	    periodic_maybe_print_message "Local network system status:"
 	else
-	    echo ""
-	    echo "Local system status:"
-	    uptime
+	    uptime |
+	    periodic_maybe_print_message "Local system status:"
 	fi;;
 esac
Index: etc/periodic/daily/440.status-mailq
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/440.status-mailq,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 440.status-mailq
--- etc/periodic/daily/440.status-mailq	2000/08/08 18:05:36	1.4.2.1
+++ etc/periodic/daily/440.status-mailq	2000/09/19 22:26:29
@@ -15,9 +15,6 @@
     [Yy][Ee][Ss])
 	if [ -x /usr/bin/mailq -a -d /var/spool/mqueue ]
 	then
-	    echo ""
-	    echo "Mail in local queue:"
-
 	    case "$daily_status_mailq_shorten" in
 		[Yy][Ee][Ss])
 		    mailq |
@@ -29,5 +26,7 @@
 		*)
 		    mailq;;
 	    esac
-	fi;;
+	fi |
+	periodic_maybe_print_message "Mail in local queue:"
+	;;
 esac
Index: etc/periodic/daily/450.status-security
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/450.status-security,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 450.status-security
--- etc/periodic/daily/450.status-security	2000/08/08 18:05:36	1.3.2.1
+++ etc/periodic/daily/450.status-security	2000/09/21 08:42:39
@@ -15,9 +15,6 @@
     [Yy][Ee][Ss])
 	if [ -f /etc/security -a -x /usr/sbin/sendmail ]
 	then
-	    echo ""
-	    echo "Security check:"
-
 	    case "$daily_status_security_noamd" in
 		[Yy][Ee][Ss])
 			args=-a;;
@@ -38,5 +35,7 @@
 		    echo "    (output mailed separately)"
 		    sh /etc/security $args 2>&1 | sendmail root;;
 	    esac
-	fi;;
+	fi |
+	periodic_maybe_print_message "Security check:"
+	;;
 esac
Index: etc/periodic/daily/460.status-mail-rejects
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/460.status-mail-rejects,v
retrieving revision 1.8.2.2
diff -u -r1.8.2.2 460.status-mail-rejects
--- etc/periodic/daily/460.status-mail-rejects	2000/08/10 11:00:08	1.8.2.2
+++ etc/periodic/daily/460.status-mail-rejects	2000/09/19 22:27:52
@@ -16,9 +16,6 @@
 	if [ -d /etc/mail -a -f /var/log/maillog -a \
 	    "$daily_status_mail_rejects_logs" -gt 0 ]
 	then
-	    echo
-	    echo Checking for rejected mail hosts:
-
 	    start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
 	    n=$(($daily_status_mail_rejects_logs - 2))
 	    {
@@ -38,5 +35,7 @@
 		perl -ne "print \"\$2\n\"
 		    if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
 		sort | uniq -c | sort -nr
-	fi;;
+	fi |
+	periodic_maybe_print_message "Checking for rejected mail hosts:"
+	;;
 esac
Index: etc/periodic/daily/999.local
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/999.local,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 999.local
--- etc/periodic/daily/999.local	2000/08/08 18:05:36	1.2.2.1
+++ etc/periodic/daily/999.local	2000/09/19 22:28:40
@@ -20,10 +20,9 @@
 	/*)
 	    if [ -f "$script" ]
 	    then
-		echo ""
-		echo "Running $script:"
-
 		sh $script
-	    fi;;
+	    fi |
+	    periodic_maybe_print_message "Running $script:"
+	    ;;
     esac
 done
Index: etc/periodic/monthly/200.accounting
===================================================================
RCS file: /home/ncvs/src/etc/periodic/monthly/200.accounting,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 200.accounting
--- etc/periodic/monthly/200.accounting	2000/08/08 18:05:38	1.4.2.1
+++ etc/periodic/monthly/200.accounting	2000/09/19 22:44:36
@@ -18,10 +18,9 @@
 	then
 	    if [ -x /usr/sbin/ac ]
 	    then
-		echo ""
-		echo "Doing login accounting:"
-
 		ac -p -w $W.0 | sort -nr +1
 	    fi
-	fi;;
+	fi |
+	periodic_maybe_print_message "Doing login accounting:"
+	;;
 esac
Index: etc/periodic/monthly/999.local
===================================================================
RCS file: /home/ncvs/src/etc/periodic/monthly/999.local,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 999.local
--- etc/periodic/monthly/999.local	2000/08/08 18:05:38	1.2.2.1
+++ etc/periodic/monthly/999.local	2000/09/19 22:45:00
@@ -17,10 +17,9 @@
 	/*)
 	    if [ -f "$script" ]
 	    then
-		echo ""
-		echo "Running $script:"
-
 		sh $script
-	    fi;;
+	    fi |
+	    periodic_maybe_print_message "Running $script:"
+	    ;;
     esac
 done
Index: etc/periodic/weekly/120.clean-kvmdb
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/120.clean-kvmdb,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 120.clean-kvmdb
--- etc/periodic/weekly/120.clean-kvmdb	2000/08/08 18:05:38	1.4.2.1
+++ etc/periodic/weekly/120.clean-kvmdb	2000/09/19 22:40:27
@@ -14,9 +14,6 @@
     [Yy][Ee][Ss])
 	if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
 	then
-	    echo ""
-	    echo "Cleaning up kernel database files:"
-
 	    kernel=`sysctl -n kern.bootfile`
 	    kernel=kvm_${kernel##*/}.db
 
@@ -29,5 +26,7 @@
 
 	    find /var/db -name "kvm_*.db" ! -name $kernel \
 		-atime +$weekly_clean_kvmdb_days -delete $print
-	fi;;
+	fi |
+	periodic_maybe_print_message "Cleaning up kernel database files:"
+	;;
 esac
Index: etc/periodic/weekly/300.uucp
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/300.uucp,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 300.uucp
--- etc/periodic/weekly/300.uucp	2000/08/08 18:05:38	1.3.2.1
+++ etc/periodic/weekly/300.uucp	2000/09/19 22:40:47
@@ -17,9 +17,8 @@
     [Yy][Ee][Ss])
 	if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]
 	then
-	    echo ""
-	    echo "Cleaning up UUCP:"
-
 	    echo /usr/libexec/uucp/clean.weekly | su daemon
-	fi;;
+	fi |
+	periodic_maybe_print_message "Cleaning up UUCP:"
+	;;
 esac
Index: etc/periodic/weekly/310.locate
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/310.locate,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 310.locate
--- etc/periodic/weekly/310.locate	2000/08/08 18:05:38	1.4.2.1
+++ etc/periodic/weekly/310.locate	2000/09/19 22:41:07
@@ -15,9 +15,6 @@
     [Yy][Ee][Ss])
 	if [ -x /usr/libexec/locate.updatedb -a -f $locdb ]
 	then
-	    echo ""
-	    echo "Rebuilding locate database:"
-
 	    locdb=/var/db/locate.database
 
 	    touch $locdb
@@ -27,5 +24,7 @@
 	    cd /
 	    echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody
 	    chmod 444 $locdb
-	fi;;
+	fi |
+	periodic_maybe_print_message "Rebuilding locate database:"
+	;;
 esac
Index: etc/periodic/weekly/320.whatis
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/320.whatis,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 320.whatis
--- etc/periodic/weekly/320.whatis	2000/08/08 18:05:38	1.5.2.1
+++ etc/periodic/weekly/320.whatis	2000/09/19 23:08:49
@@ -15,9 +15,6 @@
     [Yy][Ee][Ss])
 	if [ -x /usr/libexec/makewhatis.local -a -x /usr/bin/manpath ]
 	then
-	    echo ""
-	    echo "Rebuilding whatis database:"
-
 	    MANPATH=`/usr/bin/manpath -q`
 	    if [ $? = 0 ]
 	    then
@@ -42,5 +39,7 @@
 		    fi
 		fi
 	    fi
-	fi;;
+	fi |
+	periodic_maybe_print_message "Rebuilding whatis database:"
+	;;
 esac
Index: etc/periodic/weekly/330.catman
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/330.catman,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 330.catman
--- etc/periodic/weekly/330.catman	2000/08/08 18:05:38	1.5.2.1
+++ etc/periodic/weekly/330.catman	2000/09/19 22:42:26
@@ -16,9 +16,6 @@
 	if [ -x /usr/libexec/catman.local -a -d /usr/share/man/cat1 -a \
 	     -x /usr/bin/manpath ]
 	then
-	    echo ""
-	    echo "Reformatting manual pages:"
-
 	    MANPATH=`/usr/bin/manpath -q`
 	    if [ $? = 0 ]
 	    then
@@ -42,5 +39,7 @@
 		    fi
 		fi
 	    fi
-	fi;;
+	fi |
+	periodic_maybe_print_message "Reformatting manual pages:"
+	;;
 esac
Index: etc/periodic/weekly/340.noid
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/340.noid,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 340.noid
--- etc/periodic/weekly/340.noid	2000/08/18 06:02:03	1.2.2.1
+++ etc/periodic/weekly/340.noid	2000/09/19 22:42:54
@@ -13,9 +13,8 @@
 
 case "$weekly_noid_enable" in
     [Yy][Ee][Ss])
-	echo ""
-	echo "Check for files with an unknown user or group:"
-
 	find -H ${weekly_noid_dirs:-/} -fstype local \
-	    \( -nogroup -o -nouser \) -print | sed 's/^/  /';;
+	    \( -nogroup -o -nouser \) -print | sed 's/^/  /' |
+	periodic_maybe_print_message "Check for files with an unknown user or group:"
+	;;
 esac
Index: etc/periodic/weekly/400.status-pkg
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/400.status-pkg,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 400.status-pkg
--- etc/periodic/weekly/400.status-pkg	2000/08/08 18:05:38	1.1.2.1
+++ etc/periodic/weekly/400.status-pkg	2000/09/19 22:43:21
@@ -13,8 +13,7 @@
 
 case "$weekly_status_pkg_enable" in
     [Yy][Ee][Ss])
-	echo ""
-	echo "Check for out of date packages:"
-
-	pkg_version -v | sed -n 's/^\([^ ]*\)  *<  */  \1 /p';;
+	pkg_version -v | sed -n 's/^\([^ ]*\)  *<  */  \1 /p' |
+	periodic_maybe_print_message "Check for out of date packages:"
+	;;
 esac
Index: etc/periodic/weekly/999.local
===================================================================
RCS file: /home/ncvs/src/etc/periodic/weekly/999.local,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 999.local
--- etc/periodic/weekly/999.local	2000/08/08 18:05:38	1.3.2.1
+++ etc/periodic/weekly/999.local	2000/09/19 22:43:47
@@ -17,10 +17,8 @@
 	/*)
 	    if [ -f "$script" ]
 	    then
-		echo ""
-		echo "Running $script:"
-
 		sh $script
-	    fi;;
+	    fi |
+	    periodic_maybe_print_message "Running $script:"
     esac
 done

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009210924.e8L9ODh01744>