xref: /original-bsd/etc/weekly (revision 5b874092)
1a59fa9ecSbostic#!/bin/sh -
2a59fa9ecSbostic#
3*5b874092Sbostic#	@(#)weekly	8.2 (Berkeley) 01/02/94
4a59fa9ecSbostic#
592c853faSbostic
6f1154624SsklowerPATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
792c853faSbosticexport PATH
892c853faSbostic
907f63ef9Sbostichost=`hostname`
10a59fa9ecSbosticecho "Subject: $host weekly run output"
11a59fa9ecSbostic
12a59fa9ecSbostic#echo ""
13a59fa9ecSbostic#echo "Removing old .o files:"
1451a35e47Sbostic#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
15a59fa9ecSbostic
16c04fcb65Skarels# see if /usr/src exists and is local
17c04fcb65Skarels# before looking there for checked-out files
18c04fcb65Skarels
19c04fcb65Skarelsif [ -d /usr/src -a \
20b60fe7d7Sbostic  X"`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" != X ];
21c04fcb65Skarelsthen
22c04fcb65Skarels	echo "looking for checked out files:"
23c04fcb65Skarels	TDIR=/tmp/_checkout$$
24c04fcb65Skarels
25c04fcb65Skarels	mkdir $TDIR
267b6eb585Sbostic	for file in `find -f /usr/src ! -fstype local -prune -or \
2751a35e47Sbostic	    -name 'p.*' -print | egrep 'SCCS/p\.'`; do
28c04fcb65Skarels		owner=`awk '{ print $3 }' $file`
29c04fcb65Skarels		echo "$owner	$file"
30c04fcb65Skarels		echo $file >> $TDIR/$owner
312aa9b364Sbostic	done | sed -e 's,SCCS/p.,,' | sort
32*5b874092Sbostic	if test -n "`ls $TDIR`"; then
33c04fcb65Skarels		for file in $TDIR/*; do
34c04fcb65Skarels			sed -e 's,SCCS/p.,,' $file | \
35c04fcb65Skarels			    Mail -s 'checked out files' `basename $file`
36c04fcb65Skarels		done
37*5b874092Sbostic	fi
38c04fcb65Skarels	rm -rf $TDIR
39c04fcb65Skarelsfi
4092c853faSbostic
41a59fa9ecSbosticif [ -f /usr/lib/uucp/clean.weekly ]; then
42a59fa9ecSbostic	echo ""
43a59fa9ecSbostic	echo "Cleaning up UUCP:"
44a59fa9ecSbostic	echo /usr/lib/uucp/clean.weekly | su daemon
45a59fa9ecSbosticfi
46a59fa9ecSbosticecho ""
47c04fcb65Skarels
48cb54bf1eSbosticecho ""
49cb54bf1eSbosticecho -n "Rotating log files:"
5092c853faSbosticcd /var/log
51cb54bf1eSbosticfor i in amd messages; do
52cb54bf1eSbostic	echo -n " $i"
53cb54bf1eSbostic	if [ -f $i.5 ]; then mv -f $i.5 $i.6; fi
54cb54bf1eSbostic	if [ -f $i.4 ]; then mv -f $i.4 $i.5; fi
55cb54bf1eSbostic	if [ -f $i.3 ]; then mv -f $i.3 $i.4; fi
56cb54bf1eSbostic	if [ -f $i.2 ]; then mv -f $i.2 $i.3; fi
57cb54bf1eSbostic	if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi
58cb54bf1eSbostic	if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi
59cb54bf1eSbostic	if [ -f $i ]; then mv -f $i $i.0; fi
60cb54bf1eSbostic	>$i
61cb54bf1eSbosticdone
62cb54bf1eSbosticecho ""
63cb54bf1eSbostic
6454db76d0Sbostickill -1 `cat /var/run/syslog.pid`
65a59fa9ecSbosticcd /
66a59fa9ecSbostic
6792c853faSbosticecho ""
68f1154624Ssklowerecho "Rebuilding locate database:"
69ca4a2bc7Smckusickecho /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>/dev/null
70