weekly revision 1.16
11.1Scgd#!/bin/sh - 21.1Scgd# 31.16Skim# $NetBSD: weekly,v 1.16 2000/10/15 17:32:38 kim Exp $ 41.7Smikel# from: @(#)weekly 8.2 (Berkeley) 1/2/94 51.1Scgd# 61.1Scgd 71.11Smycroftexport PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/libexec 81.12Slukemumask 077 91.12Slukem 101.12Slukemif [ -s /etc/weekly.conf ]; then 111.12Slukem . /etc/weekly.conf 121.12Slukemfi 131.12Slukem 141.10Slukemhost=`hostname` 151.12Slukemdate=`date` 161.1Scgd 171.12Slukemecho "To: ${MAILTO:-root}" 181.12Slukemecho "Subject: $host weekly output for $date" 191.12Slukemecho "" 201.6Smrg 211.10Slukemif [ -f /etc/rc.subr ]; then 221.10Slukem . /etc/rc.subr 231.10Slukemelse 241.10Slukem echo "Can't read /etc/rc.subr; aborting." 251.10Slukem exit 1; 261.6Smrgfi 271.6Smrg 281.1Scgd#echo "" 291.1Scgd#echo "Removing old .o files:" 301.1Scgd#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; 311.1Scgd 321.1Scgd# see if /usr/src exists and is local 331.1Scgd# before looking there for checked-out files 341.1Scgd 351.2Scgd#if [ -d /usr/src -a \ 361.8Smycroft# -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ]; 371.2Scgd#then 381.16Skim# echo "" 391.16Skim# echo "Looking for checked out files:" 401.2Scgd# TDIR=/tmp/_checkout$$ 411.2Scgd# 421.2Scgd# mkdir $TDIR 431.2Scgd# for file in `find -f /usr/src ! -fstype local -prune -or \ 441.2Scgd# -name 'p.*' -print | egrep 'SCCS/p\.'`; do 451.2Scgd# owner=`awk '{ print $3 }' $file` 461.2Scgd# echo "$owner $file" 471.2Scgd# echo $file >> $TDIR/$owner 481.2Scgd# done | sed -e 's,SCCS/p.,,' 491.7Smikel# if test -n "`ls $TDIR`"; then 501.7Smikel# for file in $TDIR/*; do 511.7Smikel# sed -e 's,SCCS/p.,,' $file | \ 521.15Slukem# Mail -s 'checked out files' ${file##*/} 531.7Smikel# done 541.7Smikel# fi 551.2Scgd# rm -rf $TDIR 561.2Scgd#fi 571.1Scgd 581.10Slukemif checkyesno clean_uucp && [ -f /usr/libexec/uucp/clean.weekly ]; then 591.1Scgd echo "" 601.1Scgd echo "Cleaning up UUCP:" 611.9Slukem su daemon -c /usr/libexec/uucp/clean.weekly 621.1Scgdfi 631.1Scgd 641.16Skimif checkyesno rebuild_locatedb; then 651.16Skim echo "" 661.16Skim if [ -f /var/db/locate.database ]; then 671.16Skim echo "Rebuilding locate database:" 681.16Skim chmod 644 /var/db/locate.database 691.16Skim chown nobody:nobody /var/db/locate.database 701.16Skim nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null 711.16Skim chown root:wheel /var/db/locate.database 721.16Skim else 731.16Skim echo "Not rebuilding locate database; no /var/db/locate.database" 741.16Skim fi 751.14Sadfi 761.14Sad 771.14Sadif [ -f /etc/weekly.local ]; then 781.14Sad echo "" 791.14Sad echo "Running /etc/weekly.local:" 801.14Sad . /etc/weekly.local 811.4Scgdfi 82