1 #!/bin/sh - 2 # 3 # $NetBSD: weekly,v 1.14 2000/01/10 17:03:49 ad 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 "looking for checked out files:" 39 # TDIR=/tmp/_checkout$$ 40 # 41 # mkdir $TDIR 42 # for file in `find -f /usr/src ! -fstype local -prune -or \ 43 # -name 'p.*' -print | egrep 'SCCS/p\.'`; do 44 # owner=`awk '{ print $3 }' $file` 45 # echo "$owner $file" 46 # echo $file >> $TDIR/$owner 47 # done | sed -e 's,SCCS/p.,,' 48 # if test -n "`ls $TDIR`"; then 49 # for file in $TDIR/*; do 50 # sed -e 's,SCCS/p.,,' $file | \ 51 # Mail -s 'checked out files' `basename $file` 52 # done 53 # fi 54 # rm -rf $TDIR 55 #fi 56 57 if checkyesno clean_uucp && [ -f /usr/libexec/uucp/clean.weekly ]; then 58 echo "" 59 echo "Cleaning up UUCP:" 60 su daemon -c /usr/libexec/uucp/clean.weekly 61 fi 62 echo "" 63 64 echo "" 65 if checkyesno rebuild_locatedb && [ -f /var/db/locate.database ]; then 66 echo "Rebuilding locate database:" 67 chmod 644 /var/db/locate.database 68 chown nobody:nobody /var/db/locate.database 69 nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null 70 chown root:wheel /var/db/locate.database 71 else 72 echo "Not rebuilding locate database; no /var/db/locate.database" 73 fi 74 75 if [ -f /etc/weekly.local ]; then 76 echo "" 77 echo "Running /etc/weekly.local:" 78 . /etc/weekly.local 79 fi 80