diff --git a/etc/daily b/etc/daily index cc20848d1aeb..66b2a522619f 100644 --- a/etc/daily +++ b/etc/daily @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: daily,v 1.59 2004/04/02 13:13:47 jmmv Exp $ +# $NetBSD: daily,v 1.60 2004/04/09 17:35:21 kim Exp $ # @(#)daily 8.2 (Berkeley) 1/25/94 # @@ -284,7 +284,10 @@ if checkyesno run_skeyaudit; then fi if [ -f /etc/daily.local ]; then - echo "" - echo "Running /etc/daily.local:" - . /etc/daily.local + . /etc/daily.local > $TMP 2>&1 + if [ -s $TMP ] ; then + printf "\nRunning /etc/daily.local:\n" + cat $TMP + fi + rm -f $TMP fi diff --git a/etc/monthly b/etc/monthly index fdad2af04409..c8f4e0f3ab19 100644 --- a/etc/monthly +++ b/etc/monthly @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: monthly,v 1.9 2004/04/02 13:13:47 jmmv Exp $ +# $NetBSD: monthly,v 1.10 2004/04/09 17:35:21 kim Exp $ # from: @(#)monthly 8.1 (Berkeley) 6/9/93 # @@ -19,12 +19,26 @@ echo "To: ${MAILTO:-root}" echo "Subject: $host monthly output for $date" echo "" +MONTHLYDIR=`mktemp -d /tmp/_monthly.XXXXXX` || exit 1 + +trap "/bin/rm -rf $MONTHLYDIR ; exit 0" EXIT INT QUIT PIPE + +if ! cd "$MONTHLYDIR"; then + echo "Can not cd to $MONTHLYDIR". + exit 1 +fi + +TMP=monthly.$$ + # echo "" # echo "Doing login accounting:" # ac -p | sort -nr +1 if [ -f /etc/monthly.local ]; then - echo "" - echo "Running /etc/monthly.local:" - . /etc/monthly.local + . /etc/monthly.local > $TMP 2>&1 + if [ -s $TMP ] ; then + printf "\nRunning /etc/monthly.local:\n" + cat $TMP + fi + rm -f $TMP fi diff --git a/etc/weekly b/etc/weekly index 2cc622f144d4..38d3ea04920e 100644 --- a/etc/weekly +++ b/etc/weekly @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: weekly,v 1.18 2004/04/02 13:13:47 jmmv Exp $ +# $NetBSD: weekly,v 1.19 2004/04/09 17:35:21 kim Exp $ # from: @(#)weekly 8.2 (Berkeley) 1/2/94 # @@ -26,6 +26,17 @@ else exit 1; fi +WEEKLYDIR=`mktemp -d /tmp/_weekly.XXXXXX` || exit 1 + +trap "/bin/rm -rf $WEEKLYDIR ; exit 0" EXIT INT QUIT PIPE + +if ! cd "$WEEKLYDIR"; then + echo "Can not cd to $WEEKLYDIR". + exit 1 +fi + +TMP=weekly.$$ + #echo "" #echo "Removing old .o files:" #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; @@ -75,7 +86,10 @@ if checkyesno rebuild_locatedb; then fi if [ -f /etc/weekly.local ]; then - echo "" - echo "Running /etc/weekly.local:" - . /etc/weekly.local + . /etc/weekly.local > $TMP 2>&1 + if [ -s $TMP ] ; then + printf "\nRunning /etc/weekly.local:\n" + cat $TMP + fi + rm -f $TMP fi