Annotation of src/etc/weekly, Revision 1.23
1.1 cgd 1: #!/bin/sh -
2: #
1.23 ! martti 3: # $NetBSD: weekly,v 1.22 2007/02/15 23:04:10 reed Exp $
1.7 mikel 4: # from: @(#)weekly 8.2 (Berkeley) 1/2/94
1.1 cgd 5: #
6:
1.11 mycroft 7: export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/libexec
1.12 lukem 8: umask 077
9:
10: if [ -s /etc/weekly.conf ]; then
11: . /etc/weekly.conf
12: fi
13:
1.10 lukem 14: host=`hostname`
1.12 lukem 15: date=`date`
1.18 jmmv 16: rcvar_manpage='weekly.conf(5)'
1.1 cgd 17:
1.12 lukem 18: echo "To: ${MAILTO:-root}"
19: echo "Subject: $host weekly output for $date"
20: echo ""
1.6 mrg 21:
1.10 lukem 22: if [ -f /etc/rc.subr ]; then
23: . /etc/rc.subr
24: else
25: echo "Can't read /etc/rc.subr; aborting."
26: exit 1;
1.6 mrg 27: fi
28:
1.23 ! martti 29: WEEKLYDIR=$(mktemp -d -t _weekly) || exit 1
1.19 kim 30:
31: trap "/bin/rm -rf $WEEKLYDIR ; exit 0" EXIT INT QUIT PIPE
32:
33: if ! cd "$WEEKLYDIR"; then
34: echo "Can not cd to $WEEKLYDIR".
35: exit 1
36: fi
37:
38: TMP=weekly.$$
39:
1.1 cgd 40: #echo ""
41: #echo "Removing old .o files:"
42: #find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
43:
44: # see if /usr/src exists and is local
45: # before looking there for checked-out files
46:
1.2 cgd 47: #if [ -d /usr/src -a \
1.8 mycroft 48: # -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ];
1.2 cgd 49: #then
1.16 kim 50: # echo ""
51: # echo "Looking for checked out files:"
1.2 cgd 52: #
1.23 ! martti 53: # TDIR=$(mktemp -d -t _checkout) || exit 1
1.17 lukem 54: # trap "/bin/rm -rf $TDIR ; exit 0" EXIT INT QUIT
1.2 cgd 55: # for file in `find -f /usr/src ! -fstype local -prune -or \
56: # -name 'p.*' -print | egrep 'SCCS/p\.'`; do
57: # owner=`awk '{ print $3 }' $file`
58: # echo "$owner $file"
1.17 lukem 59: # echo $file >> "$TDIR/$owner"
1.2 cgd 60: # done | sed -e 's,SCCS/p.,,'
1.7 mikel 61: # if test -n "`ls $TDIR`"; then
62: # for file in $TDIR/*; do
63: # sed -e 's,SCCS/p.,,' $file | \
1.15 lukem 64: # Mail -s 'checked out files' ${file##*/}
1.7 mikel 65: # done
66: # fi
1.2 cgd 67: #fi
1.1 cgd 68:
1.16 kim 69: if checkyesno rebuild_locatedb; then
70: echo ""
71: if [ -f /var/db/locate.database ]; then
72: echo "Rebuilding locate database:"
73: chmod 644 /var/db/locate.database
74: chown nobody:nobody /var/db/locate.database
1.20 lukem 75: (cd / && nice -5 su -m nobody -c /usr/libexec/locate.updatedb 2>/dev/null)
1.16 kim 76: chown root:wheel /var/db/locate.database
77: else
78: echo "Not rebuilding locate database; no /var/db/locate.database"
79: fi
1.14 ad 80: fi
81:
1.22 reed 82: if checkyesno rebuild_whatisdb; then
83: echo ""
84: if [ -f /etc/man.conf -o -d /usr/share/man ]; then
85: echo "Rebuilding whatis databases:"
86: nice -n 5 /usr/libexec/makewhatis -f
87: else
88: echo "Not rebuilding whatis databases"
89: fi
90: fi
91:
1.14 ad 92: if [ -f /etc/weekly.local ]; then
1.19 kim 93: . /etc/weekly.local > $TMP 2>&1
94: if [ -s $TMP ] ; then
95: printf "\nRunning /etc/weekly.local:\n"
96: cat $TMP
97: fi
98: rm -f $TMP
1.4 cgd 99: fi
CVSweb <webmaster@jp.NetBSD.org>