Subject: compressing UUCP mail
To: None <netbsd-help@netbsd.org>
From: David Wetzel <dave@turbocat.de>
List: netbsd-help
Date: 02/27/2001 17:23:38
Hi folks,
I have some clients who get their mail via UUCP over IP.
To save bandwith I made two wrappers that compress/decompress the mails.
rmailwrapper.sh is used as wrapper for rmail. It also works, if the incoming
mail is not zipped.
uuxwrapper.sh is used as wrapper for uux. It gzips the files before calling
the real uux.
Comments are welcome!
To install use
cd /usr/libexec/
mv rmail rmail.org
chmod a+x rmailwrapper.sh
ln -s rmailwrapper.sh rmail
cd /usr/bin/
mv uux uux.org
chmod a+x uuxwrapper.sh
ln -s uuxwrapper.sh uux
---
_ _
_(_)(_)_ David Wetzel, Turbocat's Development,
(_) __ (_) Buchhorster Strasse 23, D-16567 Muehlenbeck/Berlin, FRG,
_/ \_ Fax +49 33056 82835 NeXTmail dave@turbocat.de
(______) http://www.turbocat.de/
DEVELOPMENT * CONSULTING * ADMINISTRATION
rmailwrapper.sh:
8< - - - - - - - - - - - - - - - - - - - - -
#!/bin/sh
##
## wrapper for rmail to detect and handle gzipped files
##
REALPROG=/usr/libexec/rmail.org
TMPNAME=`mktemp /tmp/uupack.XXXXXX`
echo $TMPNAME
cat > $TMPNAME.org
zcat 2>/dev/null $TMPNAME.org > $TMPNAME
# check if file is there and size >0 bytes
if [ -s $TMPNAME ]; then
# echo "ok. zcat worked"
else
# echo "zcat failed. using cat"
cp $TMPNAME.org $TMPNAME
fi
#### do something
rm $TMPNAME.org
#ls -l $TMPNAME
cat $TMPNAME | $REALPROG $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11
#echo "$REALPROG $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11" >> /tmp/rmaillog
rm $TMPNAME
8< - - - - - - - - - - - - - - - - - - - - -
uuxwrapper.sh:
8< - - - - - - - - - - - - - - - - - - - - -
#!/bin/sh
##
## wrapper for uux to gzip files
## dave@turbocat.de Tue Feb 27 16:19:29 MET 2001
##
# - -r -z -aalice.turbocat.de!root other!rmail (dave@the.other.de)
REALPROG=/usr/bin/uux.org
TMPNAME=`mktemp /tmp/uux.XXXXXX`
UUHOST=`echo $5|sed "/\!rmail/s///"`
gzip -9 > $TMPNAME
# record traffic
#cat $TMPNAME | /usr/local/bin/trafficcount u$UUHOST
cat $TMPNAME | $REALPROG $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11
rm $TMPNAME
8< - - - - - - - - - - - - - - - - - - - - -