1 #!/bin/sh - 2 # 3 # $NetBSD: weekly,v 1.16 2000/10/15 17:32:38 kim 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 17 echo "To: ${MAILTO:-root}" 18 echo "Subject: $host weekly output for $date" 19 echo "" 20 21 if [ -f /etc/rc.subr ]; then 22 . /etc/rc.subr 23 else 24 echo "Can't read /etc/rc.subr; aborting." 25 exit 1; 26 fi 27 28 #echo "" 29 #echo "Removing old .o files:" 30 #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; 31 32 # see if /usr/src exists and is local 33 # before looking there for checked-out files 34 35 #if [ -d /usr/src -a \ 36 # -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ]; 37 #then 38 # echo "" 39 # echo "Looking for checked out files:" 40 # TDIR=/tmp/_checkout$$ 41 # 42 # mkdir $TDIR 43 # for file in `find -f /usr/src ! -fstype local -prune -or \ 44 # -name 'p.*' -print | egrep 'SCCS/p\.'`; do 45 # owner=`awk '{ print $3 }' $file` 46 # echo "$owner $file" 47 # echo $file >> $TDIR/$owner 48 # done | sed -e 's,SCCS/p.,,' 49 # if test -n "`ls $TDIR`"; then 50 # for file in $TDIR/*; do 51 # sed -e 's,SCCS/p.,,' $file | \ 52 # Mail -s 'checked out files' ${file##*/} 53 # done 54 # fi 55 # rm -rf $TDIR 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