-------- Original-Nachricht --------
> Datum: Fri, 20 Nov 2009 10:43:04 -0700
> Von: Remo Mattei <[email protected]>
> An: Hugo Monteiro <[email protected]>, Gary M <[email protected]>
> CC: [email protected]
> Betreff: Re: [Dspam-user] Help with the Deliver button

> Here is mine..
> 
> #!/bin/bash
> # "Reading" variables.
> 
> if [ "$1" == "-d" ]; then
>   USER=`echo $2 | sed 's/@/ /g' | awk '{print $1}'`
>   DOMAIN=`echo $2 | sed 's/@/ /g' | awk '{print $2}'`
>   EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $2
> 
> else
>   USER=`echo $1 | sed 's/@/ /g' | awk '{print $1}'`
>   DOMAIN=`echo $1 | sed 's/@/ /g' | awk '{print $2}'`
>   EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $1
> fi
> ~       
> 
To save some CPU cycles (or allow to push more mails under heavy load) you 
could remove the need for creating a sub shell, calling sed and then calling 
awk by changing the above code to:
if [ "$1" == "-d" ]; then
        USER=${2/\...@*}
        DOMAIN=${2/*...@}
        EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $2
else
        USER=${1/\...@*}
        DOMAIN=${1/*...@}
        EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $1
fi


I don't know the format but if the passed parameter could be 
[email protected]@anything (maybe next hop or transport or I don't know) then the 
above shell trick will fail. You could then use something like this here:
if [ "$1" == "-d" ]; then
        USER=${2/\...@*}
        domain=${2...@}
        DOMAIN=${DOMAIN/\...@*}
        EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $2
else
        USER=${1/\...@*}
        domain=${1...@}
        DOMAIN=${DOMAIN/\...@*}
        EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $1
fi


Or if you want to make it shorter (I don't see the paramete "-d" used in your 
code):
[ "$1" == "-d" ] && shift
domain=${1...@}
EXT=${1/\...@*} HOST=${DOMAIN/\...@*} /home/vpopmail/bin/vdelivermail '' $1


And finally if you care about proper error handling then this should be your 
friend:
[ -z "$1" -a -z "$2" ] && exit 75 # EX_TEMPFAIL
[ "$1" == "-d" ] && shift
USER=${1/\...@*}
domain=${1...@}
DOMAIN=${DOMAIN/\...@*}
[ "$USER" == "$1" -o -z "$USER" -o -z "$DOMAIN" ] && exit 75 # EX_TEMPFAIL
EXT=$USER HOST=$DOMAIN /home/vpopmail/bin/vdelivermail '' $1


I would say that not calling the sub shell 4 times like in your code should 
make my edition +/- 4 times faster then your code.

You could try this by adding a "echo" in front of the line where you call 
vdelivermail and then call the code a bunch of time and measure the time. Maybe 
something like this here:
time for foo in {1..1000};do /home/vpopmail/bin/dspamdel.sh -d 
${[email protected];done

And then try one of my examples in a loop. I guess it should be faster. And 
faster in that case automatically means more mail throughput for your system :)


> I use vpopmail it's a sh script you need to replace this line in the
> dspam.conf to make it work..
> 
> TrustedDeliveryAgent "/home/vpopmail/bin/dspamdel.sh"       # Linux
> 
> 
> 
> Ciao
> Remo
> 
// Steve


> 
> 
> On 11/20/09 10:25 AM, "Hugo Monteiro" <[email protected]> wrote:
> 
> > Gary M wrote:
> >> Hi Paul,
> >> 
> >> The Dspam version is: *DSPAM Anti-Spam Suite 3.8.0 (agent/library)*
> >> 
> >> OS/Architecture : *CentOS 5.4/x86_64*
> >> 
> >> Web Server: *Apache/2.2.8*
> >> MTA: *Qmail*
> >> 
> >> /Dspam config:/ *http://pastebin.com/m63a16df6*
> >> 
> >> 
> >> Regards,
> >> Gary.
> >>   
> > 
> > 
> > 
> > Hello Gary,
> > 
> > 
> > Although you can deliver the messages directly with an LDA, i've been
> > using, with great success, the re-injection of the quarantined messages
> > into qmail again. This is a more general setup which will both work for
> > gateways or endpoint storage servers.
> > 
> > That's the excerpt from my web-ui configuration file.
> > 
> > 
> > $CONFIG{'DSPAM_ARGS'}   = "--deliver=innocent --class=innocent
> > --feature=whitelist,noise,chained " .
> >                           "--source=error --user %CURRENT_USER% --stdout
> " .
> >                           "| /var/qmail/bin/qmail-inject
> %CURRENT_USER%";
> > 
> > 
> > Regards,
> > 
> > Hugo Monteiro.
> > 
> >>
> ------------------------------------------------------------------------
> >> 
> >> 
> ----------------------------------------------------------------------------->>
> -
> >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> >> trial. Simplify your report design, integration and deployment - and
> focus on
> >> what you do best, core application coding. Discover what's new with
> >> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> >>
> ------------------------------------------------------------------------
> >> 
> >> _______________________________________________
> >> Dspam-user mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/dspam-user
> >>   
> > 
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day 
> trial. Simplify your report design, integration and deployment - and focus
> on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Dspam-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dspam-user

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dspam-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-user

Reply via email to