131714Sbostic#!/bin/sh - 231714Sbostic# 3*65343Sbostic# @(#)weekly 8.2 (Berkeley) 01/02/94 431714Sbostic# 537438Sbostic 640913SsklowerPATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec 737438Sbosticexport PATH 837438Sbostic 952151Sbostichost=`hostname` 1031714Sbosticecho "Subject: $host weekly run output" 1131714Sbostic 1231714Sbostic#echo "" 1331714Sbostic#echo "Removing old .o files:" 1449873Sbostic#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; 1531714Sbostic 1645688Skarels# see if /usr/src exists and is local 1745688Skarels# before looking there for checked-out files 1837438Sbostic 1945688Skarelsif [ -d /usr/src -a \ 2050118Sbostic X"`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" != X ]; 2145688Skarelsthen 2245688Skarels echo "looking for checked out files:" 2345688Skarels TDIR=/tmp/_checkout$$ 2445688Skarels 2545688Skarels mkdir $TDIR 2650047Sbostic for file in `find -f /usr/src ! -fstype local -prune -or \ 2749873Sbostic -name 'p.*' -print | egrep 'SCCS/p\.'`; do 2845688Skarels owner=`awk '{ print $3 }' $file` 2945688Skarels echo "$owner $file" 3045688Skarels echo $file >> $TDIR/$owner 3150587Sbostic done | sed -e 's,SCCS/p.,,' | sort 32*65343Sbostic if test -n "`ls $TDIR`"; then 33*65343Sbostic for file in $TDIR/*; do 34*65343Sbostic sed -e 's,SCCS/p.,,' $file | \ 35*65343Sbostic Mail -s 'checked out files' `basename $file` 36*65343Sbostic done 37*65343Sbostic fi 3845688Skarels rm -rf $TDIR 3945688Skarelsfi 4045688Skarels 4131714Sbosticif [ -f /usr/lib/uucp/clean.weekly ]; then 4231714Sbostic echo "" 4331714Sbostic echo "Cleaning up UUCP:" 4431714Sbostic echo /usr/lib/uucp/clean.weekly | su daemon 4531714Sbosticfi 4645688Skarelsecho "" 4731714Sbostic 4855274Sbosticecho "" 4955274Sbosticecho -n "Rotating log files:" 5037438Sbosticcd /var/log 5155274Sbosticfor i in amd messages; do 5255274Sbostic echo -n " $i" 5355274Sbostic if [ -f $i.5 ]; then mv -f $i.5 $i.6; fi 5455274Sbostic if [ -f $i.4 ]; then mv -f $i.4 $i.5; fi 5555274Sbostic if [ -f $i.3 ]; then mv -f $i.3 $i.4; fi 5655274Sbostic if [ -f $i.2 ]; then mv -f $i.2 $i.3; fi 5755274Sbostic if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi 5855274Sbostic if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi 5955274Sbostic if [ -f $i ]; then mv -f $i $i.0; fi 6055274Sbostic >$i 6155274Sbosticdone 6255274Sbosticecho "" 6355274Sbostic 6439125Sbostickill -1 `cat /var/run/syslog.pid` 6531714Sbosticcd / 6631714Sbostic 6737438Sbosticecho "" 6840913Ssklowerecho "Rebuilding locate database:" 6947569Smckusickecho /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null 70