xref: /csrg-svn/etc/weekly (revision 55274)
131714Sbostic#!/bin/sh -
231714Sbostic#
3*55274Sbostic#	@(#)weekly	5.18 (Berkeley) 07/15/92
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
3245688Skarels	for file in $TDIR/*; do
3345688Skarels		sed -e 's,SCCS/p.,,' $file | \
3445688Skarels		    Mail -s 'checked out files' `basename $file`
3545688Skarels	done
3645688Skarels	rm -rf $TDIR
3745688Skarelsfi
3845688Skarels
3931714Sbosticif [ -f /usr/lib/uucp/clean.weekly ]; then
4031714Sbostic	echo ""
4131714Sbostic	echo "Cleaning up UUCP:"
4231714Sbostic	echo /usr/lib/uucp/clean.weekly | su daemon
4331714Sbosticfi
4445688Skarelsecho ""
4531714Sbostic
46*55274Sbosticecho ""
47*55274Sbosticecho -n "Rotating log files:"
4837438Sbosticcd /var/log
49*55274Sbosticfor i in amd messages; do
50*55274Sbostic	echo -n " $i"
51*55274Sbostic	if [ -f $i.5 ]; then mv -f $i.5 $i.6; fi
52*55274Sbostic	if [ -f $i.4 ]; then mv -f $i.4 $i.5; fi
53*55274Sbostic	if [ -f $i.3 ]; then mv -f $i.3 $i.4; fi
54*55274Sbostic	if [ -f $i.2 ]; then mv -f $i.2 $i.3; fi
55*55274Sbostic	if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi
56*55274Sbostic	if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi
57*55274Sbostic	if [ -f $i ]; then mv -f $i $i.0; fi
58*55274Sbostic	>$i
59*55274Sbosticdone
60*55274Sbosticecho ""
61*55274Sbostic
6239125Sbostickill -1 `cat /var/run/syslog.pid`
6331714Sbosticcd /
6431714Sbostic
6537438Sbosticecho ""
6640913Ssklowerecho "Rebuilding locate database:"
6747569Smckusickecho /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null
68