Shell Script Problem

Lucas Peet sirsky at lucastek.com
Wed Nov 6 05:30:47 CST 2002


I've got a problem here with a shell script:

#!/bin/sh
echo DEFANGED.406
exit
#!/bin/sh
#
# filter.sh
#
# Simple filter to plug Anomy Sanitizer and SpamAssassin
# into the Postfix MTA
#
# From http://advosys.ca/papers/postfix-filtering.html
# Advosys Consulting Inc., Ottawa
#
# For use with:
#    Postfix 20010228 or later
#    Anomy Sanitizer revision 1.49 or later
#    SpamAssassin 2.42 or later
#
# Note: Modify the file locations to match your particular
#       server and installation of SpamAssassin.

# File locations:
# (CHANGE AS REQUIRED TO MATCH YOUR SERVER)
INSPECT_DIR=/var/spool/mailfilter
SENDMAIL=/usr/sbin/sendmail
ANOMY=/usr/local/anomy
ANOMY_CONF=/usr/local/anomy/anomy.conf
SPAMASSASSIN=/usr/bin/spamassassin

export ANOMY

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }

# Clean up when done or when aborting.
#trap "rm -f in.$$; rm -f out.$$" 0 1 2 3 15

cat | $SPAMASSASSIN -x | $ANOMY/bin/sanitizer.pl    $ANOMY_CONF 2>>/tmp/anomy.log > out.$$ ||    { 
echo Message content rejected; exit $EX_UNAVAILABLE; }

$SENDMAIL -i "$@" < out.$$

exit $?

The problem is where the 'cat' line hits the 'or' ( || ).  For some
reason, when I send email attachments (or large emails) through this
script, it dies at the || part.  

I did some hacking around, and took everything off after the '|| '
through the next line, and everything seems to work just fine.  I'd
still like to have that error checking in there though, so if anyone can
help...I'd appreciate it!

Thanks,

-Lucas




More information about the Kclug mailing list