Annotation of src/etc/weekly, Revision 1.6
1.1 deraadt 1: #!/bin/sh -
2: #
1.6 ! millert 3: # $OpenBSD: weekly,v 1.5 1997/01/03 23:33:50 millert Exp $
1.1 deraadt 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:
1.2 david 12: if [ -f /etc/weekly.local ];then
13: echo ""
14: echo "Running weekly.local:"
15: . /etc/weekly.local
16: fi
17:
1.6 ! millert 18:
1.1 deraadt 19: #echo ""
20: #echo "Removing old .o files:"
21: #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
22:
23: # see if /usr/src exists and is local
24: # before looking there for checked-out files
25:
26: #if [ -d /usr/src -a \
27: # X"`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" != X ];
28: #then
29: # echo "looking for checked out files:"
30: # TDIR=/tmp/_checkout$$
31: #
1.4 millert 32: # if ! mkdir $TDIR ; then
33: # echo "temp dir $TDIR already exists! Probable spoof attempt."
34: # ls -alF $TDIR
35: # else
36: # for file in `find -f /usr/src ! -fstype local -prune -or \
37: # -name 'p.*' -print | egrep 'SCCS/p\.'`; do
38: # owner=`awk '{ print $3 }' $file`
39: # echo "$owner $file"
40: # echo $file >> $TDIR/$owner
41: # done | sed -e 's,SCCS/p.,,'
42: # for file in $TDIR/*; do
43: # sed -e 's,SCCS/p.,,' $file | \
44: # Mail -s 'checked out files' `basename $file`
45: # done
46: # rm -rf $TDIR
47: # fi
1.1 deraadt 48: #fi
49:
50: if [ -f /usr/lib/uucp/clean.weekly ]; then
51: echo ""
52: echo "Cleaning up UUCP:"
53: echo /usr/lib/uucp/clean.weekly | su daemon
54: fi
55: echo ""
56:
57: # Rotation of message log now handled automatically by cron and 'newsyslog'
58:
59: echo ""
60: if [ -f /var/db/locate.database ]; then
1.6 ! millert 61: TMP=`mktemp /var/db/locate.database.XXXXXX`
! 62: if [ $? -eq 0 ]; then
! 63: trap 'rm -f $TMP' 0 1 15
! 64: echo "Rebuilding locate database:"
! 65: echo "/usr/libexec/locate.updatedb --fcodes=-" | nice -5 su -m nobody 2>/dev/null 1>$TMP
! 66: if [ -s "$TMP" ]; then
! 67: chmod 444 $TMP
! 68: chown root.wheel $TMP
! 69: mv -f $TMP /var/db/locate.database
! 70: else
! 71: echo "Not installing locate database; zero size"
! 72: fi
! 73: else
! 74: echo "Not rebuilding locate database; can't create temp file"
! 75: fi
1.1 deraadt 76: else
77: echo "Not rebuilding locate database; no /var/db/locate.database"
78: fi