weekly revision 1.10
11.1Scgd#!/bin/sh - 21.1Scgd# 31.10Slukem# $NetBSD: weekly,v 1.10 1998/01/26 12:02:58 lukem Exp $ 41.7Smikel# from: @(#)weekly 8.2 (Berkeley) 1/2/94 51.1Scgd# 61.1Scgd 71.1ScgdPATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec 81.1Scgdexport PATH 91.10Slukemhost=`hostname` 101.10Slukemecho "Subject: $host weekly run output" 111.1Scgd 121.6Smrgumask 077 131.6Smrg 141.10Slukemif [ -f /etc/rc.subr ]; then 151.10Slukem . /etc/rc.subr 161.10Slukemelse 171.10Slukem echo "Can't read /etc/rc.subr; aborting." 181.10Slukem exit 1; 191.10Slukemfi 201.1Scgd 211.6Smrgif [ -s /etc/weekly.conf ]; then 221.6Smrg . /etc/weekly.conf 231.6Smrgfi 241.6Smrg 251.1Scgd#echo "" 261.1Scgd#echo "Removing old .o files:" 271.1Scgd#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; 281.1Scgd 291.1Scgd# see if /usr/src exists and is local 301.1Scgd# before looking there for checked-out files 311.1Scgd 321.2Scgd#if [ -d /usr/src -a \ 331.8Smycroft# -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ]; 341.2Scgd#then 351.2Scgd# echo "looking for checked out files:" 361.2Scgd# TDIR=/tmp/_checkout$$ 371.2Scgd# 381.2Scgd# mkdir $TDIR 391.2Scgd# for file in `find -f /usr/src ! -fstype local -prune -or \ 401.2Scgd# -name 'p.*' -print | egrep 'SCCS/p\.'`; do 411.2Scgd# owner=`awk '{ print $3 }' $file` 421.2Scgd# echo "$owner $file" 431.2Scgd# echo $file >> $TDIR/$owner 441.2Scgd# done | sed -e 's,SCCS/p.,,' 451.7Smikel# if test -n "`ls $TDIR`"; then 461.7Smikel# for file in $TDIR/*; do 471.7Smikel# sed -e 's,SCCS/p.,,' $file | \ 481.7Smikel# Mail -s 'checked out files' `basename $file` 491.7Smikel# done 501.7Smikel# fi 511.2Scgd# rm -rf $TDIR 521.2Scgd#fi 531.1Scgd 541.10Slukemif checkyesno clean_uucp && [ -f /usr/libexec/uucp/clean.weekly ]; then 551.1Scgd echo "" 561.1Scgd echo "Cleaning up UUCP:" 571.9Slukem su daemon -c /usr/libexec/uucp/clean.weekly 581.1Scgdfi 591.1Scgdecho "" 601.1Scgd 611.1Scgdecho "" 621.10Slukemif checkyesno rebuild_locatedb && [ -f /var/db/locate.database ]; then 631.4Scgd echo "Rebuilding locate database:" 641.4Scgd chmod 644 /var/db/locate.database 651.4Scgd chown nobody.nobody /var/db/locate.database 661.9Slukem nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null 671.4Scgd chown root.wheel /var/db/locate.database 681.4Scgdelse 691.4Scgd echo "Not rebuilding locate database; no /var/db/locate.database" 701.4Scgdfi 71