[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Remove mail in smarthost Exim queues sent from specific IP address

On Sat, Feb 17, 2007 at 01:22:09PM -0800, Cameron L. Spitzer wrote:
> [This message has also been posted to linux.debian.isp.]
> In article <7O6mB-8fD-15@gated-at.bofh.it>, Brett Parker wrote:
> > On Tue, Feb 13, 2007 at 02:14:42PM +0100, Robert Tasarz wrote:
> >> Dan Harris wrote:
> >> 
> >> something easier than this? :)
> >> 
> >> grep '\[192\.168\.11\.11\] P=' /var/log/exim4/mainlog |cut -d\
> >> -f3|while read id; do /usr/sbin/exim4 -Mrm $id; done
> >
> > If there's thousands I suggest a slightly nicer way:
> >         grep '\[192\.168\.11\.11\] P=' /var/log/exim4/mainlog | \
> >                 cut -d " " -f 3 | xargs /usr/sbin/exim4 -Mrm
> >
> > lots less exim4 processes
> Are you sure?  xargs(1) says "-l[max-lines]  Use  at  most max-lines
> nonblank input lines per command line; max-lines defaults to 1 if
> omitted."  ITYM

Apparently you don't understand just *how* often I use xargs ;) By
default xargs (with no options) fills the command line buffer with
arguments, xargs -l limits the number of arguments to (potentially) less
than the possible command line length. (I also quite often use xargs to
fire off a process per input line, but at that point I'm usually using
--replace and doing some truly evil things, if you get bored go take a
looksee at bpgallery.sh which can be grabbed from...
that uses find and xargs "rather a lot").

Brett Parker

Reply to: