1 #!/bin/sh - 2 # 3 # $NetBSD: weekly,v 1.17 2001/06/18 10:54:02 lukem 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 # 41 # TDIR=`mktemp -d /tmp/_checkout.XXXXXX` || exit 1 42 # trap "/bin/rm -rf $TDIR ; exit 0" EXIT INT QUIT 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 #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 63 if checkyesno rebuild_locatedb; then 64 echo "" 65 if [ -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 fi 75 76 if [ -f /etc/weekly.local ]; then 77 echo "" 78 echo "Running /etc/weekly.local:" 79 . /etc/weekly.local 80 fi 81