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

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



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
> 
>   cut -d" " -f3 | xargs -l30 /usr/sbin/exim4 -Mrm
> 
> otherwise you're still running one exim4 -Mrm per message.

Are you sure? ;)

$ seq 1 4|xargs -l echo
1
2
3
4

but:
$ seq 1 4|xargs echo
1 2 3 4

So with -l alone it indeed means one command per input line, but plain
xargs gives one command line up to 131072 chars long (according to man).

(and thanks Brett for correcting me with faster method :) )

Regards,
  Robert Tasarz



Reply to: