On Tue, Sep 29, 2009 at 10:55:32PM +0200, Len Conrad wrote:

> here's mine, very fast with "find":
> 
> #!/bin/sh
> 
> for Q in incoming active deferred hold
> do
> SIZE=`find /mail/spool/postfix/$Q -maxdepth 5 -type f | wc -l | tr -d ' '`
> dd if=/dev/zero bs=1 count=$SIZE of=/var/db/postfix/q_size_$Q
> done
> exit 0

The find(1) is less efficient than it should be, because you don't need
to lstat(2) the files as with "-type f". All the sub-directories of
the queues have single-letter names, and all the queue-files have
multi-letter names. With a POSIX shell, avoid the `cmd` construct.

    n=$$( $(find /var/spool/postfix/$Q ! -name "?" ! | wc -l) - 1 )

-- 
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majord...@postfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.

Reply via email to