xref: /titanic_52/usr/src/cmd/bnu/uudemon.cleanup (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate#!/usr/bin/sh
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
4*7c478bd9Sstevel@tonic-gate#
5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
7*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
8*7c478bd9Sstevel@tonic-gate# with the License.
9*7c478bd9Sstevel@tonic-gate#
10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
13*7c478bd9Sstevel@tonic-gate# and limitations under the License.
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
20*7c478bd9Sstevel@tonic-gate#
21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate#
24*7c478bd9Sstevel@tonic-gate# Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
25*7c478bd9Sstevel@tonic-gate# Use is subject to license terms.
26*7c478bd9Sstevel@tonic-gate#
27*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate#
29*7c478bd9Sstevel@tonic-gate#	This demon cleans up uucp directories.
30*7c478bd9Sstevel@tonic-gate#	It is started by /var/spool/cron/crontabs/uucp;
31*7c478bd9Sstevel@tonic-gate#	it can be run daily, weekly, whatever depending on the system
32*7c478bd9Sstevel@tonic-gate#	  uucp load.
33*7c478bd9Sstevel@tonic-gate#
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gate# return a list of systems defined in /etc/uucp/Systems
36*7c478bd9Sstevel@tonic-gategetsystems() {
37*7c478bd9Sstevel@tonic-gateif [ ! -f /etc/uucp/Systems ]; then
38*7c478bd9Sstevel@tonic-gate  return
39*7c478bd9Sstevel@tonic-gateelse
40*7c478bd9Sstevel@tonic-gate  awk '$1 !~ /^#/ {print $1}' /etc/uucp/Systems
41*7c478bd9Sstevel@tonic-gatefi
42*7c478bd9Sstevel@tonic-gate}
43*7c478bd9Sstevel@tonic-gate
44*7c478bd9Sstevel@tonic-gate# return a list of systems defined in /etc/asppp.cf
45*7c478bd9Sstevel@tonic-gategetpppsystems() {
46*7c478bd9Sstevel@tonic-gateif [ ! -f /etc/asppp.cf ]; then
47*7c478bd9Sstevel@tonic-gate  return
48*7c478bd9Sstevel@tonic-gateelse
49*7c478bd9Sstevel@tonic-gate  X=`sed -e 's/#.*$//' /etc/asppp.cf`
50*7c478bd9Sstevel@tonic-gate  set -- $X
51*7c478bd9Sstevel@tonic-gate  while [ $# -ne 0 ];
52*7c478bd9Sstevel@tonic-gate  do
53*7c478bd9Sstevel@tonic-gate      if [ "$1" = "peer_system_name" ]; then
54*7c478bd9Sstevel@tonic-gate          PPPSYSTEMS="$PPPSYSTEMS $2"
55*7c478bd9Sstevel@tonic-gate      fi
56*7c478bd9Sstevel@tonic-gate      shift
57*7c478bd9Sstevel@tonic-gate  done
58*7c478bd9Sstevel@tonic-gate  echo "$PPPSYSTEMS"
59*7c478bd9Sstevel@tonic-gatefi
60*7c478bd9Sstevel@tonic-gate}
61*7c478bd9Sstevel@tonic-gate
62*7c478bd9Sstevel@tonic-gatenouucp() {
63*7c478bd9Sstevel@tonic-gate# run through the systems list, deleting ppp systems
64*7c478bd9Sstevel@tonic-gateoutstr=""
65*7c478bd9Sstevel@tonic-gatefor i in `getsystems`
66*7c478bd9Sstevel@tonic-gatedo
67*7c478bd9Sstevel@tonic-gate    del=0
68*7c478bd9Sstevel@tonic-gate    for j in `getpppsystems`
69*7c478bd9Sstevel@tonic-gate    do
70*7c478bd9Sstevel@tonic-gate        if [ "$j" = "$i" ]; then
71*7c478bd9Sstevel@tonic-gate            del=1
72*7c478bd9Sstevel@tonic-gate        fi
73*7c478bd9Sstevel@tonic-gate    done
74*7c478bd9Sstevel@tonic-gate    if [ $del -ne 1 ]; then
75*7c478bd9Sstevel@tonic-gate        outstr="$outstr $i"
76*7c478bd9Sstevel@tonic-gate    fi
77*7c478bd9Sstevel@tonic-gatedone
78*7c478bd9Sstevel@tonic-gate
79*7c478bd9Sstevel@tonic-gate# if any names are in $outstr, assume uucp is configured
80*7c478bd9Sstevel@tonic-gate
81*7c478bd9Sstevel@tonic-gateif [ -n "$outstr" ]; then
82*7c478bd9Sstevel@tonic-gate	return 1
83*7c478bd9Sstevel@tonic-gateelse
84*7c478bd9Sstevel@tonic-gate	return 0
85*7c478bd9Sstevel@tonic-gatefi
86*7c478bd9Sstevel@tonic-gate}
87*7c478bd9Sstevel@tonic-gate
88*7c478bd9Sstevel@tonic-gate# Start of actual processing. For energystar compatibility,
89*7c478bd9Sstevel@tonic-gate# we attempt to do as little I/O as possible, so first check
90*7c478bd9Sstevel@tonic-gate# to see if uucp is configured before doing all this work.
91*7c478bd9Sstevel@tonic-gate
92*7c478bd9Sstevel@tonic-gateif nouucp; then
93*7c478bd9Sstevel@tonic-gate	exit 0
94*7c478bd9Sstevel@tonic-gatefi
95*7c478bd9Sstevel@tonic-gate
96*7c478bd9Sstevel@tonic-gateMAILTO=uucp
97*7c478bd9Sstevel@tonic-gateMAILDIR=/var/mail
98*7c478bd9Sstevel@tonic-gateexport PATH
99*7c478bd9Sstevel@tonic-gatePATH=/usr/bin:/usr/lib/uucp
100*7c478bd9Sstevel@tonic-gateTMP=/tmp/uu$$
101*7c478bd9Sstevel@tonic-gate
102*7c478bd9Sstevel@tonic-gate#	Running as uucp, take care to protect things
103*7c478bd9Sstevel@tonic-gate
104*7c478bd9Sstevel@tonic-gateumask 0022
105*7c478bd9Sstevel@tonic-gate
106*7c478bd9Sstevel@tonic-gate#
107*7c478bd9Sstevel@tonic-gate#	These are taken from the Makefile.  If changed in Makefile
108*7c478bd9Sstevel@tonic-gate#	they must be changed here also.
109*7c478bd9Sstevel@tonic-gate#
110*7c478bd9Sstevel@tonic-gatePUBDIR=/var/spool/uucppublic
111*7c478bd9Sstevel@tonic-gateSPOOL=/var/spool/uucp
112*7c478bd9Sstevel@tonic-gateVAR=/var/uucp
113*7c478bd9Sstevel@tonic-gateLOCKS=/var/spool/locks	# needs a comment in parms.h on USRSPOOLOCKS
114*7c478bd9Sstevel@tonic-gateXQTDIR=$VAR/.Xqtdir
115*7c478bd9Sstevel@tonic-gateCORRUPT=$SPOOL/.Corrupt
116*7c478bd9Sstevel@tonic-gateLOGDIR=$VAR/.Log
117*7c478bd9Sstevel@tonic-gateSEQDIR=$VAR/.Sequence
118*7c478bd9Sstevel@tonic-gateSTATDIR=$VAR/.Status
119*7c478bd9Sstevel@tonic-gateWORKDIR=$SPOOL/.Workspace
120*7c478bd9Sstevel@tonic-gateADMIN=$VAR/.Admin
121*7c478bd9Sstevel@tonic-gate
122*7c478bd9Sstevel@tonic-gate#	OLD is the directory for archiving old admin/log files
123*7c478bd9Sstevel@tonic-gateOLD=$VAR/.Old
124*7c478bd9Sstevel@tonic-gateO_LOGS=$OLD/Old-Log
125*7c478bd9Sstevel@tonic-gateACCT_LOGS=$OLD/Old-acct
126*7c478bd9Sstevel@tonic-gateSEC_LOGS=$OLD/Old-sec
127*7c478bd9Sstevel@tonic-gate
128*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/xferstats ] && mv $ADMIN/xferstats $OLD/xferstats
129*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/audit ] && mv $ADMIN/audit $OLD/audit
130*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/command ] &&mv $ADMIN/command $OLD/command
131*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/errors ] && mv $ADMIN/errors $OLD/errors
132*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/Foreign ] && mv $ADMIN/Foreign $OLD/Foreign
133*7c478bd9Sstevel@tonic-gate
134*7c478bd9Sstevel@tonic-gate> $ADMIN/xferstats
135*7c478bd9Sstevel@tonic-gate> $ADMIN/audit
136*7c478bd9Sstevel@tonic-gate> $ADMIN/command
137*7c478bd9Sstevel@tonic-gate> $ADMIN/errors
138*7c478bd9Sstevel@tonic-gate> $ADMIN/Foreign
139*7c478bd9Sstevel@tonic-gate
140*7c478bd9Sstevel@tonic-gate#
141*7c478bd9Sstevel@tonic-gate#	If performance log exists, save it and create a new one
142*7c478bd9Sstevel@tonic-gate#
143*7c478bd9Sstevel@tonic-gateif [ -f $ADMIN/perflog ]
144*7c478bd9Sstevel@tonic-gatethen
145*7c478bd9Sstevel@tonic-gate	mv $ADMIN/perflog $OLD/perflog
146*7c478bd9Sstevel@tonic-gate	> $ADMIN/perflog
147*7c478bd9Sstevel@tonic-gatefi
148*7c478bd9Sstevel@tonic-gate
149*7c478bd9Sstevel@tonic-gate#
150*7c478bd9Sstevel@tonic-gate#	The list in the for controls how many old Log and security logs
151*7c478bd9Sstevel@tonic-gate#	are retained: 2 -> 3, 1 -> 2, current -> 1.
152*7c478bd9Sstevel@tonic-gate#
153*7c478bd9Sstevel@tonic-gatefor i in  2 1
154*7c478bd9Sstevel@tonic-gatedo
155*7c478bd9Sstevel@tonic-gate	j=`expr $i + 1`
156*7c478bd9Sstevel@tonic-gate	[ -f ${O_LOGS}-$i ] && mv ${O_LOGS}-$i ${O_LOGS}-$j
157*7c478bd9Sstevel@tonic-gate	[ -f ${SEC_LOGS}-$i ] && mv ${SEC_LOGS}-$i ${SEC_LOGS}-$j
158*7c478bd9Sstevel@tonic-gatedone
159*7c478bd9Sstevel@tonic-gate
160*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/security ] && mv $ADMIN/security ${SEC_LOGS}-1
161*7c478bd9Sstevel@tonic-gate> $ADMIN/security
162*7c478bd9Sstevel@tonic-gate
163*7c478bd9Sstevel@tonic-gate#
164*7c478bd9Sstevel@tonic-gate#	Combine all log files into O_LOGS-1.
165*7c478bd9Sstevel@tonic-gate#	Add a name separator between each system.
166*7c478bd9Sstevel@tonic-gate#
167*7c478bd9Sstevel@tonic-gate> ${O_LOGS}-1
168*7c478bd9Sstevel@tonic-gatefor i in uucico uucp uux uuxqt
169*7c478bd9Sstevel@tonic-gatedo
170*7c478bd9Sstevel@tonic-gate	if [ ! -d $LOGDIR/$i ]
171*7c478bd9Sstevel@tonic-gate	then
172*7c478bd9Sstevel@tonic-gate	      (echo "uudemon.cleanup: $LOGDIR/$i directory does not exist, remove if file"
173*7c478bd9Sstevel@tonic-gate	       echo "uudemon.cleanup: making a directory $LOGDIR/$i"
174*7c478bd9Sstevel@tonic-gate	      ) | mail $MAILTO
175*7c478bd9Sstevel@tonic-gate		rm -f $LOGDIR/$i
176*7c478bd9Sstevel@tonic-gate		mkdir $LOGDIR/$i
177*7c478bd9Sstevel@tonic-gate		continue
178*7c478bd9Sstevel@tonic-gate	fi
179*7c478bd9Sstevel@tonic-gate	cd $LOGDIR/$i
180*7c478bd9Sstevel@tonic-gate
181*7c478bd9Sstevel@tonic-gate#	can't compare exactly because of symlinks
182*7c478bd9Sstevel@tonic-gate	case `pwd` in
183*7c478bd9Sstevel@tonic-gate	*`basename $LOGDIR`/$i)
184*7c478bd9Sstevel@tonic-gate		;;
185*7c478bd9Sstevel@tonic-gate	*)
186*7c478bd9Sstevel@tonic-gate	 	 (echo "uudemon.cleanup: unable to chdir to $LOGDIR/$i") | mail $MAILTO
187*7c478bd9Sstevel@tonic-gate		continue
188*7c478bd9Sstevel@tonic-gate		;;
189*7c478bd9Sstevel@tonic-gate	esac
190*7c478bd9Sstevel@tonic-gate	for j in *
191*7c478bd9Sstevel@tonic-gate	do
192*7c478bd9Sstevel@tonic-gate		if [ "$j" = "*" ]
193*7c478bd9Sstevel@tonic-gate		then
194*7c478bd9Sstevel@tonic-gate			break
195*7c478bd9Sstevel@tonic-gate		fi
196*7c478bd9Sstevel@tonic-gate		echo "********** $j ********** ($i)" >> ${O_LOGS}-1
197*7c478bd9Sstevel@tonic-gate		cat $j >> ${O_LOGS}-1
198*7c478bd9Sstevel@tonic-gate		rm -f $j
199*7c478bd9Sstevel@tonic-gate	done
200*7c478bd9Sstevel@tonic-gatedone
201*7c478bd9Sstevel@tonic-gate
202*7c478bd9Sstevel@tonic-gate#
203*7c478bd9Sstevel@tonic-gate#	If the accounting log exists, save it and create a new one.
204*7c478bd9Sstevel@tonic-gate#	The list in the for controls how many old accounting logs
205*7c478bd9Sstevel@tonic-gate#	are retained: 2 -> 3, 1 -> 2, current -> 1.
206*7c478bd9Sstevel@tonic-gate#
207*7c478bd9Sstevel@tonic-gateif [ -f $ADMIN/account ]
208*7c478bd9Sstevel@tonic-gatethen
209*7c478bd9Sstevel@tonic-gate	for i in  2 1
210*7c478bd9Sstevel@tonic-gate	do
211*7c478bd9Sstevel@tonic-gate		j=`expr $i + 1`
212*7c478bd9Sstevel@tonic-gate		[ -f ${ACCT_LOGS}-$i ] && mv ${ACCT_LOGS}-$i ${ACCT_LOGS}-$j
213*7c478bd9Sstevel@tonic-gate	done
214*7c478bd9Sstevel@tonic-gate	[ -f $ADMIN/account ] && mv $ADMIN/account ${ACCT_LOGS}-1
215*7c478bd9Sstevel@tonic-gate	> $ADMIN/account
216*7c478bd9Sstevel@tonic-gatefi
217*7c478bd9Sstevel@tonic-gate
218*7c478bd9Sstevel@tonic-gate#	Execute the system directory cleanup program
219*7c478bd9Sstevel@tonic-gate#	See uucleanup.1m for details.
220*7c478bd9Sstevel@tonic-gateuucleanup -D7 -C7 -X2 -o2 -W1
221*7c478bd9Sstevel@tonic-gate
222*7c478bd9Sstevel@tonic-gate#	Use the grep instead of the mv to ignore warnings to uucp
223*7c478bd9Sstevel@tonic-gate# grep -v 'warning message sent to uucp' $ADMIN/uucleanup > $OLD/uucleanup
224*7c478bd9Sstevel@tonic-gate[ -f $ADMIN/uucleanup ] && mv $ADMIN/uucleanup $OLD/uucleanup
225*7c478bd9Sstevel@tonic-gateif [ -s $OLD/uucleanup ]
226*7c478bd9Sstevel@tonic-gatethen
227*7c478bd9Sstevel@tonic-gate	(echo "Subject: cleanup"; echo; cat $OLD/uucleanup) | mail $MAILTO
228*7c478bd9Sstevel@tonic-gatefi
229*7c478bd9Sstevel@tonic-gate>$ADMIN/uucleanup
230*7c478bd9Sstevel@tonic-gate
231*7c478bd9Sstevel@tonic-gate#  cleanup funny directories that may have been created in the spool areas
232*7c478bd9Sstevel@tonic-gatefor d in $SPOOL/[0-9A-Za-z]*
233*7c478bd9Sstevel@tonic-gatedo
234*7c478bd9Sstevel@tonic-gate	if [ -f $d ]
235*7c478bd9Sstevel@tonic-gate	then
236*7c478bd9Sstevel@tonic-gate		# skip any regular files, like lockfiles
237*7c478bd9Sstevel@tonic-gate		# and mail.log and so forth
238*7c478bd9Sstevel@tonic-gate		continue
239*7c478bd9Sstevel@tonic-gate	fi
240*7c478bd9Sstevel@tonic-gate	if [ -z "`ls $d`" ]
241*7c478bd9Sstevel@tonic-gate	then
242*7c478bd9Sstevel@tonic-gate		# empty directory
243*7c478bd9Sstevel@tonic-gate		continue
244*7c478bd9Sstevel@tonic-gate	fi
245*7c478bd9Sstevel@tonic-gate	cd $d
246*7c478bd9Sstevel@tonic-gate	# we'd check that we were in the correct directory
247*7c478bd9Sstevel@tonic-gate	if [ "`basename \`pwd\``" != "`basename $d`" ]
248*7c478bd9Sstevel@tonic-gate	then
249*7c478bd9Sstevel@tonic-gate		(echo "uudemon.cleanup: unable to chdir to $d") | mail $MAILTO
250*7c478bd9Sstevel@tonic-gate		continue
251*7c478bd9Sstevel@tonic-gate	fi
252*7c478bd9Sstevel@tonic-gate	for s in */*
253*7c478bd9Sstevel@tonic-gate	do
254*7c478bd9Sstevel@tonic-gate		if [ "$s" = "*/*" ]
255*7c478bd9Sstevel@tonic-gate		then
256*7c478bd9Sstevel@tonic-gate			break
257*7c478bd9Sstevel@tonic-gate		fi
258*7c478bd9Sstevel@tonic-gate		if [ -d $s ]
259*7c478bd9Sstevel@tonic-gate		then
260*7c478bd9Sstevel@tonic-gate			# Remove subdirs of subdirs
261*7c478bd9Sstevel@tonic-gate			rm -fr $s
262*7c478bd9Sstevel@tonic-gate		fi
263*7c478bd9Sstevel@tonic-gate	done
264*7c478bd9Sstevel@tonic-gate
265*7c478bd9Sstevel@tonic-gate	# if it is now empty, remove it.
266*7c478bd9Sstevel@tonic-gate	cd ..
267*7c478bd9Sstevel@tonic-gate	rmdir $d/* $d
268*7c478bd9Sstevel@tonic-gatedone >/dev/null 2>&1
269*7c478bd9Sstevel@tonic-gate
270*7c478bd9Sstevel@tonic-gate#
271*7c478bd9Sstevel@tonic-gate#	Find old cores
272*7c478bd9Sstevel@tonic-gate#
273*7c478bd9Sstevel@tonic-gatefind $SPOOL -name core -print > $TMP
274*7c478bd9Sstevel@tonic-gateif [ -s $TMP ]
275*7c478bd9Sstevel@tonic-gatethen
276*7c478bd9Sstevel@tonic-gate	(echo "Subject: cores"; echo; cat $TMP) | mail $MAILTO
277*7c478bd9Sstevel@tonic-gatefi
278*7c478bd9Sstevel@tonic-gate
279*7c478bd9Sstevel@tonic-gate#
280*7c478bd9Sstevel@tonic-gate#	Remove old files and directories
281*7c478bd9Sstevel@tonic-gate#
282*7c478bd9Sstevel@tonic-gate#find $PUBDIR -type f -mtime +30 -exec rm -f {} \;
283*7c478bd9Sstevel@tonic-gatefind $PUBDIR/* -depth -type d -exec rmdir {} \; >/dev/null 2>&1
284*7c478bd9Sstevel@tonic-gatefind $SPOOL/* -depth -type d -exec rmdir {} \; >/dev/null 2>&1
285*7c478bd9Sstevel@tonic-gatefind $SEQDIR -type f -mtime +30 -exec rm -f {} \;
286*7c478bd9Sstevel@tonic-gatefind $WORKDIR -type f -mtime +1 -exec rm -f {} \;
287*7c478bd9Sstevel@tonic-gatefind $STATDIR -type f -mtime +2 -exec rm -f {} \;
288*7c478bd9Sstevel@tonic-gatefind $CORRUPT -type f -mtime +10 -exec rm -f {} \;
289*7c478bd9Sstevel@tonic-gate
290*7c478bd9Sstevel@tonic-gaterm -f $LOCKS/LTMP*
291*7c478bd9Sstevel@tonic-gatermdir $SPOOL/[0-9A-Za-z]* >/dev/null 2>&1
292*7c478bd9Sstevel@tonic-gate
293*7c478bd9Sstevel@tonic-gate#
294*7c478bd9Sstevel@tonic-gate#	Mail a daily summary of status
295*7c478bd9Sstevel@tonic-gate#
296*7c478bd9Sstevel@tonic-gategrep passwd ${O_LOGS}-1 > $TMP
297*7c478bd9Sstevel@tonic-gategrep "REQUEST.*/" ${O_LOGS}-1 >> $TMP
298*7c478bd9Sstevel@tonic-gateif [ -s $TMP ]
299*7c478bd9Sstevel@tonic-gatethen
300*7c478bd9Sstevel@tonic-gate	(echo "Subject: uucp requests"; echo; cat $TMP) | mail $MAILTO
301*7c478bd9Sstevel@tonic-gatefi
302*7c478bd9Sstevel@tonic-gate
303*7c478bd9Sstevel@tonic-gate
304*7c478bd9Sstevel@tonic-gateawk '/(DENIED)/	{print prev}
305*7c478bd9Sstevel@tonic-gate		{prev = $0}' ${O_LOGS}-1 > $TMP
306*7c478bd9Sstevel@tonic-gateif [ -s $TMP ]
307*7c478bd9Sstevel@tonic-gatethen
308*7c478bd9Sstevel@tonic-gate	(echo "Subject: uucp DENIED"; echo; cat $TMP) | mail $MAILTO
309*7c478bd9Sstevel@tonic-gatefi
310*7c478bd9Sstevel@tonic-gate
311*7c478bd9Sstevel@tonic-gateuustat -q > $TMP
312*7c478bd9Sstevel@tonic-gateif [ -s $TMP ]
313*7c478bd9Sstevel@tonic-gatethen
314*7c478bd9Sstevel@tonic-gate	(echo "Subject: uu-status"; echo; cat $TMP) | mail $MAILTO
315*7c478bd9Sstevel@tonic-gatefi
316*7c478bd9Sstevel@tonic-gate
317*7c478bd9Sstevel@tonic-gatels $CORRUPT > $TMP
318*7c478bd9Sstevel@tonic-gateif [ -s $TMP ]
319*7c478bd9Sstevel@tonic-gatethen
320*7c478bd9Sstevel@tonic-gate	(echo "Subject: $CORRUPT"; echo; cat $TMP) | mail $MAILTO
321*7c478bd9Sstevel@tonic-gatefi
322*7c478bd9Sstevel@tonic-gate
323*7c478bd9Sstevel@tonic-gateif [ -s $OLD/errors -o -s $OLD/Foreign ]
324*7c478bd9Sstevel@tonic-gatethen
325*7c478bd9Sstevel@tonic-gate	(echo "Subject: uucp Admin"; \
326*7c478bd9Sstevel@tonic-gate	echo; echo tail errors; tail $OLD/errors; \
327*7c478bd9Sstevel@tonic-gate	echo; echo tail Foreign; tail $OLD/Foreign; \
328*7c478bd9Sstevel@tonic-gate	) | mail $MAILTO
329*7c478bd9Sstevel@tonic-gatefi
330*7c478bd9Sstevel@tonic-gate# don't run if no system directories exist
331*7c478bd9Sstevel@tonic-gateif [ "`echo $SPOOL/*`" != "$SPOOL/*" ]
332*7c478bd9Sstevel@tonic-gatethen
333*7c478bd9Sstevel@tonic-gate	(echo "Subject: uucleanup ran; $SPOOL du"; echo; du $SPOOL) | \
334*7c478bd9Sstevel@tonic-gate		mail $MAILTO
335*7c478bd9Sstevel@tonic-gatefi
336*7c478bd9Sstevel@tonic-gate
337*7c478bd9Sstevel@tonic-gate#
338*7c478bd9Sstevel@tonic-gate#	Dispose of mail to nuucp
339*7c478bd9Sstevel@tonic-gate#
340*7c478bd9Sstevel@tonic-gaterm -f $MAILDIR/nuucp $TMP
341