| 1 | #!/bin/sh - |
| 2 | # |
| 3 | # @(#)weekly 5.12 (Berkeley) %G% |
| 4 | # |
| 5 | |
| 6 | PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec |
| 7 | export PATH |
| 8 | |
| 9 | host=`hostname -s` |
| 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.,,' |
| 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 "Rotating messages:" |
| 47 | cd /var/log |
| 48 | if [ -f messages.2 ]; then mv -f messages.2 messages.3; fi |
| 49 | if [ -f messages.1 ]; then mv -f messages.1 messages.2; fi |
| 50 | if [ -f messages.0 ]; then mv -f messages.0 messages.1; fi |
| 51 | mv -f messages messages.0 |
| 52 | cp /dev/null messages |
| 53 | chmod 644 messages |
| 54 | kill -1 `cat /var/run/syslog.pid` |
| 55 | cd / |
| 56 | |
| 57 | echo "" |
| 58 | echo "Rebuilding locate database:" |
| 59 | echo /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null |