| 1 | #!/bin/sh - |
| 2 | # |
| 3 | # @(#)weekly 5.18 (Berkeley) %G% |
| 4 | # |
| 5 | |
| 6 | PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec |
| 7 | export PATH |
| 8 | |
| 9 | host=`hostname` |
| 10 | echo "Subject: $host weekly run output" |
| 11 | |
| 12 | #echo "" |
| 13 | #echo "Removing old .o files:" |
| 14 | #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \; |
| 15 | |
| 16 | # see if /usr/src exists and is local |
| 17 | # before looking there for checked-out files |
| 18 | |
| 19 | if [ -d /usr/src -a \ |
| 20 | X"`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" != X ]; |
| 21 | then |
| 22 | echo "looking for checked out files:" |
| 23 | TDIR=/tmp/_checkout$$ |
| 24 | |
| 25 | mkdir $TDIR |
| 26 | for file in `find -f /usr/src ! -fstype local -prune -or \ |
| 27 | -name 'p.*' -print | egrep 'SCCS/p\.'`; do |
| 28 | owner=`awk '{ print $3 }' $file` |
| 29 | echo "$owner $file" |
| 30 | echo $file >> $TDIR/$owner |
| 31 | done | sed -e 's,SCCS/p.,,' | sort |
| 32 | for file in $TDIR/*; do |
| 33 | sed -e 's,SCCS/p.,,' $file | \ |
| 34 | Mail -s 'checked out files' `basename $file` |
| 35 | done |
| 36 | rm -rf $TDIR |
| 37 | fi |
| 38 | |
| 39 | if [ -f /usr/lib/uucp/clean.weekly ]; then |
| 40 | echo "" |
| 41 | echo "Cleaning up UUCP:" |
| 42 | echo /usr/lib/uucp/clean.weekly | su daemon |
| 43 | fi |
| 44 | echo "" |
| 45 | |
| 46 | echo "" |
| 47 | echo -n "Rotating log files:" |
| 48 | cd /var/log |
| 49 | for i in amd messages; do |
| 50 | echo -n " $i" |
| 51 | if [ -f $i.5 ]; then mv -f $i.5 $i.6; fi |
| 52 | if [ -f $i.4 ]; then mv -f $i.4 $i.5; fi |
| 53 | if [ -f $i.3 ]; then mv -f $i.3 $i.4; fi |
| 54 | if [ -f $i.2 ]; then mv -f $i.2 $i.3; fi |
| 55 | if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi |
| 56 | if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi |
| 57 | if [ -f $i ]; then mv -f $i $i.0; fi |
| 58 | >$i |
| 59 | done |
| 60 | echo "" |
| 61 | |
| 62 | kill -1 `cat /var/run/syslog.pid` |
| 63 | cd / |
| 64 | |
| 65 | echo "" |
| 66 | echo "Rebuilding locate database:" |
| 67 | echo /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null |