|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U u
Length: 3691 (0xe6b)
Types: TextFile
Notes: UNIX file
Names: »uudemon.cleanu«
└─⟦07a570ed8⟧ Bits:30004042/network2.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦07a570ed8⟧ UNIX Filesystem
└─⟦this⟧ »bn/new/usr/lib/uucp/uudemon.cleanu«
#!/bin/sh
#ident "@(#)uucp:uudemon.cleanup 2.2"
#
# This demon cleans up uucp directories.
# It is started by /usr/lib/crontab;
# it can be run daily, weekly, whatever depending on the system
# uucp load.
# The log files get large so you may have to up the ulimit.
# e.g.
#
# 45 23 * * * ulimit 5000; /bin/su uucp -c "/usr/lib/uucp/uudemon.cleanu"
#
MAILTO=uucp
MAILDIR=/usr/mail
export PATH
PATH=/bin:/usr/bin:/usr/lib/uucp:/usr/lbin
TMP=/tmp/uu$$
#
# These are taken from the Makefile. If changed in Makefile
# they must be changed here also.
#
PUBDIR=/usr/spool/uucppublic
SPOOL=/usr/spool/uucp
LOCKS=/usr/spool/locks
XQTDIR=/usr/spool/uucp/.Xqtdir
CORRUPT=/usr/spool/uucp/.Corrupt
LOGDIR=/usr/spool/uucp/.Log
SEQDIR=/usr/spool/uucp/.Sequence
STATDIR=/usr/spool/uucp/.Status
WORKDIR=/usr/spool/uucp/.Workspace
ADMIN=/usr/spool/uucp/.Admin
# OLD is the directory for archiving old admin/log files
OLD=$SPOOL/.Old
O_LOGS=$OLD/Old-Log
mv $ADMIN/xferstats $OLD/xferstats
mv $ADMIN/audit $OLD/audit
mv $ADMIN/errors $OLD/errors
mv $ADMIN/Foreign $OLD/Foreign
> $ADMIN/xferstats
> $ADMIN/audit
> $ADMIN/errors
> $ADMIN/Foreign
#
# The list in the for controls how many old LOG files are retained.
# O_LOGS-2 goes to O_LOGS-3, O_LOGS-1 goes to O_LOGS-2.
# Todays goes to O_LOGS-1
#
for i in 2 1
do
j=`expr $i + 1`
mv ${O_LOGS}-$i ${O_LOGS}-$j
done
#
# Combine all log files into O_LOGS-1.
# Add a name separator between each system.
#
> ${O_LOGS}-1
for i in uucico uucp uux uuxqt
do
cd $LOGDIR/$i
for j in *
do
if [ "$j" = "*" ]
then
break
fi
echo "********** $j **********" >> ${O_LOGS}-1
cat $j >> ${O_LOGS}-1
rm -f $j
done
done
# Execute the system directory cleanup program
# See uucleanup.1m for details.
uucleanup -D7 -C7 -X2 -o2 -W1
# Use the grep instead of the mv to ignore warnings to uucp
# grep -v 'warning message sent to uucp' $ADMIN/uucleanup > $OLD/uucleanup
mv $ADMIN/uucleanup $OLD/uucleanup
if [ -s $OLD/uucleanup ]
then
(echo "Subject: cleanup"; cat $OLD/uucleanup) | mail $MAILTO
fi
>$ADMIN/uucleanup
# cleanup funny directories that may have been created in the spool areas
for d in $SPOOL/[A-z]*
do
if [ -z "`ls $d`" ]; then
continue
fi
cd $d
for s in *
do
if [ "$s" = "*" ]
then
break
fi
if [ -d $s ]
then
rm -fr $s
fi
done
# if it is now empty, remove it.
cd ..
rmdir $d
done 2>&1 >/dev/null
#
# Find old cores
#
find $SPOOL -name core -print > $TMP
if [ -s $TMP ]
then
(echo "Subject: cores"; cat $TMP) | mail $MAILTO
fi
#
# Remove old files and directories
#
find $PUBDIR -type f -mtime +30 -exec rm -f {} \;
find $PUBDIR/* -type d -exec rmdir {} \;
find $SEQDIR -mtime +30 -exec rm -f {} \;
find $WORKDIR -mtime +1 -exec rm -f {} \;
find $STATDIR -mtime +2 -exec rm -f {} \;
find $CORRUPT -mtime +10 -exec rm -f {} \;
rm -f $LOCKS/LTMP*
rmdir $SPOOL/[A-z]* 2>/dev/null
#
# Mail a daily summary of status
#
grep passwd ${O_LOGS}-1 > $TMP
grep "REQUEST.*/" ${O_LOGS}-1 >> $TMP
if [ -s $TMP ]
then
(echo "Subject: uucp requests"; cat $TMP) | mail $MAILTO
fi
awk '/(DENIED)/ {print prev}
{prev = $0}' ${O_LOGS}-1 > $TMP
if [ -s $TMP ]
then
(echo "Subject: uucp DENIED"; cat $TMP) | mail $MAILTO
fi
uustat -q > $TMP
if [ -s $TMP ]
then
(echo "Subject: uu-status"; cat $TMP) | mail $MAILTO
fi
ls $CORRUPT > $TMP
if [ -s $TMP ]
then
(echo "Subject: $CORRUPT"; cat $TMP) | mail $MAILTO
fi
tail $OLD/errors 2>/dev/null > $TMP
tail $OLD/Foreign 2>/dev/null >> $TMP
if [ -s $TMP ]
then
(echo "Subject: uucp Admin"; cat $TMP) | mail $MAILTO
fi
(echo "Subject: uucleanup ran; $SPOOL du"; du $SPOOL) | mail $MAILTO
#
# Dispose of mail to uucp and nuucp
#
rm -f $MAILDIR/uucp $MAILDIR/nuucp $TMP