xref: /csrg-svn/etc/weekly (revision 50587)
131714Sbostic#!/bin/sh -
231714Sbostic#
3*50587Sbostic#	@(#)weekly	5.16 (Berkeley) 07/27/91
431714Sbostic#
537438Sbostic
640913SsklowerPATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
737438Sbosticexport PATH
837438Sbostic
945176Sbostichost=`hostname -s`
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
31*50587Sbostic	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
4631714Sbosticecho "Rotating messages:"
4737438Sbosticcd /var/log
4831714Sbosticif [ -f messages.2 ]; then mv -f messages.2 messages.3; fi
4931714Sbosticif [ -f messages.1 ]; then mv -f messages.1 messages.2; fi
5031714Sbosticif [ -f messages.0 ]; then mv -f messages.0 messages.1; fi
5131714Sbosticmv -f messages   messages.0
5231714Sbosticcp /dev/null  messages
5331714Sbosticchmod 644 messages
5439125Sbostickill -1 `cat /var/run/syslog.pid`
5531714Sbosticcd /
5631714Sbostic
5737438Sbosticecho ""
5840913Ssklowerecho "Rebuilding locate database:"
5947569Smckusickecho /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null
60