home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume3
/
clr.queue
< prev
next >
Wrap
Text File
|
1986-11-30
|
2KB
|
89 lines
Subject: sendmail clean-up script
From: David Barto <genrad!celerity!barto>
Newsgroups: mod.sources
Approved: jpn@panda.UUCP
Mod.sources: Volume 3, Issue 43
Submitted by: David Barto <ihnp4!bang!celerity!barto>
: feed me to sh
cat > INFO <<'end-INFO'
The following is a script to track and mail to ADMIN the
clean up of the sendmail queue. This clears invalid files,
moves out the wedged mail and sends a report to the administrator
listed in ADMIN.
I have been using it for about 3 months without problems, and It
lets me know how well the local area network moves its mail.
I install it as /usr/adm/clr.queue, and have cron run it once
a nite at about 2am. (low active user count).
end-INFO
cat > clr.queue <<'end-clr.queue'
#! /bin/csh -f
# clear the sendmail queue of any waiting mail
#
set ADMIN = barto
set mqueue = /usr/spool/mqueue
set output = /tmp/clr.out$$
cat /dev/null > $output
cd $mqueue
foreach f (*)
switch ($f)
case 'syslog*': # skip log files
breaksw;
case 'df*':
set qf = `echo $f | sed -e 's/df/qf/' `
if (! -e $qf) then
echo "Missing qf file for $f" >> $output
echo "Contents of $f follow:" >> $output
cat $f >> $output
echo "---- end of $f" >> $output
echo "/bin/rm -f $f" >> $output
/bin/rm -f $f
else if (-z $f) then
echo "$f is empty, deleted" >> $output
/bin/rm -f $f
endif
breaksw
case 'xf*':
case 'lf*':
echo /bin/rm $f >> $output
/bin/rm $f
breaksw
case 'qf*':
set df = `echo $f | sed -e 's/qf/df/' `
if (! -e $df) then
echo "Missing df file for $f" >> $output
echo "Contents of $f follow:" >> $output
cat $f >> $output
echo "---- end of $f" >> $output
echo /bin/rm $f >> $output
/bin/rm $f
endif
breaksw
default:
echo "Invalid file $f, deleted" >> $output
/bin/rm -f $f
breaksw
endsw
end
/usr/lib/sendmail -q -v >> $output
if (! -z $output) then
Mail -s "Sendmail Cleanup" $ADMIN < $output
endif
/bin/rm $output
end-clr.queue
exit