Hi,

Wednesday, November 28, 2001, 12:34:04 PM, you wrote:
MH> is there a patch available for vpopmail 5.0 / vchkpw
MH> to log, how many eMails the user is downloading, e.g.


I use the following script (called poplog), which I found elsewhere
and adapted. It does just that. Important: see "NOTES" below!!

=============== poplog begin ===============
#!/bin/sh
newmail=`ls $PWD/Maildir/new/ | wc -l`
newmailbytes=`du -sb $PWD/Maildir/new/ | cut -f 1`

oldmail=`ls $PWD/Maildir/cur/ | wc -l`
oldmailbytes=`du -sb $PWD/Maildir/cur/ | cut -f 1`

USER="Username: `basename $PWD`"
pushd .. 1>/dev/null
DIR="`basename $PWD`"
popd 1>/dev/null

echo "$USER@$DIR" "New mails: " "$newmail" "(" "$newmailbytes" " \
Bytes); Old mails: " "$oldmail" " (" "$oldmailbytes" " Bytes)" | \
/var/qmail/bin/splogger pop3d 18  

pop="$1"; shift; exec "$pop" "$@"
=============== poplog end ===============


"poplog" is called in my qmail startup script like so:

==============================
/usr/local/bin/tcpserver -RHO -v 0 pop3 /var/qmail/bin/qmail-popup \
FQDN /data/vpopmail/bin/vchkpw.log_to_local2 /batches/poplog \
/var/qmail/bin/qmail-pop3d Maildir 2>&1 | /var/qmail/bin/splogger \
pop3d 18 &
==============================


NOTE!
=====
My pop users were clogging up /var/log/mail, so I hard coded syslog
facility "local2" into qmail-vchkpw (saved as "vchkpw.log_to_local2")
in the above example, so all pop activity goes to /var/log/pop3. I
assume you're using standard logging, so please replace all instances
of "18" with "2" for standard "/var/log/mail" logging.

ALSO replace FQDN with your own FQDN, of course!!


Best regards,

 Barry

Reply via email to