1 #!/bin/sh - 2 # 3 # $NetBSD: weekly,v 1.18 2004/04/02 13:13:47 jmmv Exp $ 4 # from: @(#)weekly 8.2 (Berkeley) 1/2/94 5 # 6 7 export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/libexec 8 umask 077 9 10 if [ -s /etc/weekly.conf ]; then 11 . /etc/weekly.conf 12 fi 13 14 host=`hostname` 15 date=`date` 16 rcvar_manpage='weekly.conf(5)' 17 18 echo "To: ${MAILTO:-root}" 19 echo "Subject: $host weekly output for $date" 20 echo "" 21 22 if [ -f /etc/rc.subr ]; then 23 . /etc/rc.subr 24 else 25 echo "Can't read /etc/rc.subr; aborting." 26 exit 1; 27 fi 28 29 #echo "" 30 #echo "Removing old .o files:" 31 #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; 32 33 # see if /usr/src exists and is local 34 # before looking there for checked-out files 35 36 #if [ -d /usr/src -a \ 37 # -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ]; 38 #then 39 # echo "" 40 # echo "Looking for checked out files:" 41 # 42 # TDIR=`mktemp -d /tmp/_checkout.XXXXXX` || exit 1 43 # trap "/bin/rm -rf $TDIR ; exit 0" EXIT INT QUIT 44 # for file in `find -f /usr/src ! -fstype local -prune -or \ 45 # -name 'p.*' -print | egrep 'SCCS/p\.'`; do 46 # owner=`awk '{ print $3 }' $file` 47 # echo "$owner $file" 48 # echo $file >> "$TDIR/$owner" 49 # done | sed -e 's,SCCS/p.,,' 50 # if test -n "`ls $TDIR`"; then 51 # for file in $TDIR/*; do 52 # sed -e 's,SCCS/p.,,' $file | \ 53 # Mail -s 'checked out files' ${file##*/} 54 # done 55 # fi 56 #fi 57 58 if checkyesno clean_uucp && [ -f /usr/libexec/uucp/clean.weekly ]; then 59 echo "" 60 echo "Cleaning up UUCP:" 61 su daemon -c /usr/libexec/uucp/clean.weekly 62 fi 63 64 if checkyesno rebuild_locatedb; then 65 echo "" 66 if [ -f /var/db/locate.database ]; then 67 echo "Rebuilding locate database:" 68 chmod 644 /var/db/locate.database 69 chown nobody:nobody /var/db/locate.database 70 nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null 71 chown root:wheel /var/db/locate.database 72 else 73 echo "Not rebuilding locate database; no /var/db/locate.database" 74 fi 75 fi 76 77 if [ -f /etc/weekly.local ]; then 78 echo "" 79 echo "Running /etc/weekly.local:" 80 . /etc/weekly.local 81 fi 82