weekly revision 1.11
11.1Scgd#!/bin/sh - 21.1Scgd# 31.11Smycroft# $NetBSD: weekly,v 1.11 1998/07/16 05:21:56 mycroft 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.10Slukemhost=`hostname` 91.10Slukemecho "Subject: $host weekly run output" 101.1Scgd 111.6Smrgumask 077 121.6Smrg 131.10Slukemif [ -f /etc/rc.subr ]; then 141.10Slukem . /etc/rc.subr 151.10Slukemelse 161.10Slukem echo "Can't read /etc/rc.subr; aborting." 171.10Slukem exit 1; 181.10Slukemfi 191.1Scgd 201.6Smrgif [ -s /etc/weekly.conf ]; then 211.6Smrg . /etc/weekly.conf 221.6Smrgfi 231.6Smrg 241.1Scgd#echo "" 251.1Scgd#echo "Removing old .o files:" 261.1Scgd#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; 271.1Scgd 281.1Scgd# see if /usr/src exists and is local 291.1Scgd# before looking there for checked-out files 301.1Scgd 311.2Scgd#if [ -d /usr/src -a \ 321.8Smycroft# -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ]; 331.2Scgd#then 341.2Scgd# echo "looking for checked out files:" 351.2Scgd# TDIR=/tmp/_checkout$$ 361.2Scgd# 371.2Scgd# mkdir $TDIR 381.2Scgd# for file in `find -f /usr/src ! -fstype local -prune -or \ 391.2Scgd# -name 'p.*' -print | egrep 'SCCS/p\.'`; do 401.2Scgd# owner=`awk '{ print $3 }' $file` 411.2Scgd# echo "$owner $file" 421.2Scgd# echo $file >> $TDIR/$owner 431.2Scgd# done | sed -e 's,SCCS/p.,,' 441.7Smikel# if test -n "`ls $TDIR`"; then 451.7Smikel# for file in $TDIR/*; do 461.7Smikel# sed -e 's,SCCS/p.,,' $file | \ 471.7Smikel# Mail -s 'checked out files' `basename $file` 481.7Smikel# done 491.7Smikel# fi 501.2Scgd# rm -rf $TDIR 511.2Scgd#fi 521.1Scgd 531.10Slukemif checkyesno clean_uucp && [ -f /usr/libexec/uucp/clean.weekly ]; then 541.1Scgd echo "" 551.1Scgd echo "Cleaning up UUCP:" 561.9Slukem su daemon -c /usr/libexec/uucp/clean.weekly 571.1Scgdfi 581.1Scgdecho "" 591.1Scgd 601.1Scgdecho "" 611.10Slukemif checkyesno rebuild_locatedb && [ -f /var/db/locate.database ]; then 621.4Scgd echo "Rebuilding locate database:" 631.4Scgd chmod 644 /var/db/locate.database 641.4Scgd chown nobody.nobody /var/db/locate.database 651.9Slukem nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null 661.4Scgd chown root.wheel /var/db/locate.database 671.4Scgdelse 681.4Scgd echo "Not rebuilding locate database; no /var/db/locate.database" 691.4Scgdfi 70