Re: [vchkpw] listing over-quota users

2005-03-11 Thread green-vpopmail
but wait, there is more!. :)

in squirrelmail try moving a big email from inbox to some folder. open that 
folder and delete the email. quota usage won't change as it should.
effectively, deletion from any folder other than INBOX will not change quota 
usage. 

there is plenty of inconsistencies like that all over the place. I realized 
that taking care of quota recalculation and other maintenance activities should 
be performed via scripts.


-- 
Igor


On Fri, Mar 11, 2005 at 04:06:41PM -0500, Charles Sprickman wrote:
-> On Fri, 11 Mar 2005 [EMAIL PROTECTED] wrote:
-> 
-> >this is a listing of a sample Maildir directory on my server. it has all 
-> >these files and directories that have to do with courier IMAP. while 
-> >they don't take much in some cases, sometimes they can take a couple of 
-> >percent from the overall quota. in addition there are two directories 
-> >(IMAP folders) .Junk (where all spam is forwarded) and .Trash (courier 
-> >IMAP/squirrelmail default trash +folder).
-> 
-> Doh!  Now I see why I'm off so much.  I forgot about .Trash not being 
-> counted.  I'll have to revamp things to account for that.
-> 
-> Thanks!
-> 
-> Charles
-> 
-> 
-> >-- 
-> >Igor
-> >
-> >
-> >On Thu, Mar 10, 2005 at 07:26:10PM -0500, Charles Sprickman wrote:
-> >-> On Wed, 9 Mar 2005 [EMAIL PROTECTED] wrote:
-> >->
-> >-> >this method is of course fast and dirty, but it might not work for
-> >-> >everyone out there.
-> >-> >
-> >-> >the best aproach is to write a perl script that runs queries on a
-> >-> >database, gets path to a user's mailbox on the server, uses File::Find
-> >-> >to include only files in Maildir/cur and Maildir/new as well as
-> >-> >:subfolders:/cur and :subfolders:/new with the exception of trash
-> >-> >folders. that should give a much clearer picture. in addition it can
-> >-> >scale better.
-> >->
-> >-> I have something similar, but it's not very generic, so I don't know if
-> >-> anyone would be interested.  I've added a few fields to the vpopmail 
-> >table
-> >-> to record when they first hit quota so I can get a report (quick php 
-> >page)
-> >-> of who's over and for how long.
-> >->
-> >-> To get usage, I'm just hitting the user's homedir with du, can you 
-> >comment
-> >-> a bit on why I would need to count only the mail?  There shouldn't 
-> >really
-> >-> be anything of note in the user's directory besides the mail...
-> >->
-> >-> It is quite interesting to see how much the "real" usage (provided by 
-> >du)
-> >-> can differ from the maildirsize info.
-> >->
-> >-> Charles
-> >->
-> >-> >--
-> >-> >Igor
-> >-> >
-> >-> >
-> >-> >On Wed, Mar 09, 2005 at 08:08:10AM -0800, Charles J. Boening wrote:
-> >-> >-> Here's what I do.  I don't have too many domains or users do it 
-> >doesn't
-> >-> >-> take too long.
-> >-> >->
-> >-> >-> du -sk /home/vpopmail/domains/*/*/Maildir > /tmp/maildirusage && du 
-> >-sk
-> >-> >-> /home/vpopmail/domains/*/*/*/Maildir >> /tmp/maildirusage && cat
-> >-> >-> /tmp/maildirusage | sort -n | tail -n50 | sort -n -r | mail -s "Mail
-> >-> >-> User Quota" 
-> >-> >->
-> >-> >->
-> >-> >-> This only gets the top 50 users.  You can change it easily.  I don't
-> >-> >-> think it would be very efficient for multiple domains.  In that 
-> >case you
-> >-> >-> may want to break it up into a run for each domain.
-> >-> >->
-> >-> >-> I'd definitely like to see something more efficient :)
-> >-> >->
-> >-> >->
-> >-> >-> Charlie
-> >-> >->
-> >-> >->
-> >-> >->
-> >-> >-> 
-> >-> >->
-> >-> >->  From: Tanmaya Anand [mailto:[EMAIL PROTECTED]
-> >-> >->  Sent: Tuesday, March 08, 2005 11:44 PM
-> >-> >->  To: vchkpw@inter7.com
-> >-> >->  Subject: [vchkpw] listing over-quota users
-> >-> >->
-> >-> >->
-> >-> >->
-> >-> >->  Hi
-> >-> >->
-> >-> >->  I need to list all over-quota users on the system for all
-> >-> >-> domains.
-> >-> >->  Can anyone help me with some similiar perl / shell script to 
-> >get
-> >-> >-> this done.
-> >-> >->
-> >-> >->  Regards,
-> >-> >->  Tanmaya
-> >-> >->
-> >-> >->
-> >-> >->
-> >-> >->   
-> >-> >->
-> >-> >->
-> >-> >
-> >


Re: [vchkpw] listing over-quota users

2005-03-11 Thread Charles Sprickman
On Fri, 11 Mar 2005 [EMAIL PROTECTED] wrote:
this is a listing of a sample Maildir directory on my server. it has all 
these files and directories that have to do with courier IMAP. while 
they don't take much in some cases, sometimes they can take a couple of 
percent from the overall quota. in addition there are two directories 
(IMAP folders) .Junk (where all spam is forwarded) and .Trash (courier 
IMAP/squirrelmail default trash +folder).
Doh!  Now I see why I'm off so much.  I forgot about .Trash not being 
counted.  I'll have to revamp things to account for that.

Thanks!
Charles

--
Igor
On Thu, Mar 10, 2005 at 07:26:10PM -0500, Charles Sprickman wrote:
-> On Wed, 9 Mar 2005 [EMAIL PROTECTED] wrote:
->
-> >this method is of course fast and dirty, but it might not work for
-> >everyone out there.
-> >
-> >the best aproach is to write a perl script that runs queries on a
-> >database, gets path to a user's mailbox on the server, uses File::Find
-> >to include only files in Maildir/cur and Maildir/new as well as
-> >:subfolders:/cur and :subfolders:/new with the exception of trash
-> >folders. that should give a much clearer picture. in addition it can
-> >scale better.
->
-> I have something similar, but it's not very generic, so I don't know if
-> anyone would be interested.  I've added a few fields to the vpopmail table
-> to record when they first hit quota so I can get a report (quick php page)
-> of who's over and for how long.
->
-> To get usage, I'm just hitting the user's homedir with du, can you comment
-> a bit on why I would need to count only the mail?  There shouldn't really
-> be anything of note in the user's directory besides the mail...
->
-> It is quite interesting to see how much the "real" usage (provided by du)
-> can differ from the maildirsize info.
->
-> Charles
->
-> >--
-> >Igor
-> >
-> >
-> >On Wed, Mar 09, 2005 at 08:08:10AM -0800, Charles J. Boening wrote:
-> >-> Here's what I do.  I don't have too many domains or users do it doesn't
-> >-> take too long.
-> >->
-> >-> du -sk /home/vpopmail/domains/*/*/Maildir > /tmp/maildirusage && du -sk
-> >-> /home/vpopmail/domains/*/*/*/Maildir >> /tmp/maildirusage && cat
-> >-> /tmp/maildirusage | sort -n | tail -n50 | sort -n -r | mail -s "Mail
-> >-> User Quota" 
-> >->
-> >->
-> >-> This only gets the top 50 users.  You can change it easily.  I don't
-> >-> think it would be very efficient for multiple domains.  In that case you
-> >-> may want to break it up into a run for each domain.
-> >->
-> >-> I'd definitely like to see something more efficient :)
-> >->
-> >->
-> >-> Charlie
-> >->
-> >->
-> >->
-> >-> 
-> >->
-> >-> From: Tanmaya Anand [mailto:[EMAIL PROTECTED]
-> >-> Sent: Tuesday, March 08, 2005 11:44 PM
-> >-> To: vchkpw@inter7.com
-> >-> Subject: [vchkpw] listing over-quota users
-> >->
-> >->
-> >->
-> >-> Hi
-> >->
-> >-> I need to list all over-quota users on the system for all
-> >-> domains.
-> >-> Can anyone help me with some similiar perl / shell script to get
-> >-> this done.
-> >->
-> >-> Regards,
-> >-> Tanmaya
-> >->
-> >->
-> >->
-> >->  
-> >->
-> >->
-> >


Re: [vchkpw] listing over-quota users

2005-03-11 Thread green-vpopmail
what I have set up might be a little different from you have, but take a look 
at this:
# ls -al
  
total 26
  
drwx--  12 vpopmail vchkpw  536 Nov 29 10:23 .  
  
drwx--   3 vpopmail vchkpw  128 Sep 28 17:23 .. 
  
-rw---   1 vpopmail vchkpw  775 Sep 18  2003 bincimap-cache 
  
-rw---   1 vpopmail vchkpw   67 Jul 28  2003 bincimap-subscribed
  
-rw---   1 vpopmail vchkpw   56 Sep 18  2003 bincimap-uidvalidity   
  
drwxr-xr-x   2 vpopmail vchkpw   72 Aug 18  2004 courierimaphieracl 
  
drwx--   2 vpopmail vchkpw   48 Nov 17 11:06 courierimapkeywords
  
-rw-r--r--   1 vpopmail vchkpw   58 Sep 24  2003 courierimapsubscribed  
  
-rw-r--r--   1 vpopmail vchkpw   61 Nov 29 10:23 courierimapuiddb   
  
drwx--   2 vpopmail vchkpw  112 Nov 29 10:29 cur
  
drwx--   6 vpopmail vchkpw  256 Aug 18  2004 .Drafts
  
drwxr-xr-x   6 vpopmail vchkpw  224 Nov 15 17:12 .Junk  
  
-rw---   1 vpopmail vchkpw   18 Mar 11 00:32 maildirsize
  
drwx--   2 vpopmail vchkpw 1120 Mar  5 03:05 new
  
drwx--   6 vpopmail vchkpw  256 Aug 18  2004 .Sent  
  
drwx--   6 vpopmail vchkpw  224 Aug 18  2004 .test  
  
drwx--   2 vpopmail vchkpw   48 Mar  5 03:05 tmp
  
drwx--   6 vpopmail vchkpw  328 Sep 13 12:42 .Trash 
  

  
this is a listing of a sample Maildir directory on my server. it has all these 
files and directories that have to do with courier IMAP.   
while they don't take much in some cases, sometimes they can take a couple of 
percent from the overall quota. 
in addition there are two directories (IMAP folders) .Junk (where all spam is 
forwarded) and .Trash (courier IMAP/squirrelmail default trash  
+folder). when you use squirrelmail to delete an email, it gets forwarded to 
.Trash, and maildirsize file is changed to not count this email  
+against quota. in addition, spam can quickly fill .Junk and the user will not 
be able to receive good email messages. so, the policy in my   
+place is to count only good email that sits anywhere but .Junk and .Trash. 
Also, to prevent users from having gigantic number of messages in 
+these two directories - there is a script that deletes anything that's older 
than 7 days in these two directories.

-- 
Igor


On Thu, Mar 10, 2005 at 07:26:10PM -0500, Charles Sprickman wrote:
-> On Wed, 9 Mar 2005 [EMAIL PROTECTED] wrote:
-> 
-> >this method is of course fast and dirty, but it might not work for 
-> >everyone out there.
-> >
-> >the best aproach is to write a perl script that runs queries on a 
-> >database, gets path to a user's mailbox on the server, uses File::Find 
-> >to include only files in Maildir/cur and Maildir/new as well as 
-> >:subfolders:/cur and :subfolders:/new with the exception of trash 
-> >folders. that should give a much clearer picture. in addition it can 
-> >scale better.
-> 
-> I have something similar, but it's not very generic, so I don't know if 
-> anyone would be interested.  I've added a few fields to the vpopmail table 
-> to record when they first hit quota so I can get a report (quick php page) 
-> of who's over and for how long.
-> 
-> To get usage, I'

Re: [vchkpw] listing over-quota users

2005-03-10 Thread Rainer Duffner
Charles J. Boening wrote:
How about the following the following
 | grep -v "^[0-9]%"
Should work.
 

Yup.
I always get confused where I have to set the quotes...
Thanks.
Rainer
--
===
~ Rainer Duffner - [EMAIL PROTECTED] ~
~   Freising - Munich - Germany   ~
~Unix - Linux - BSD - OpenSource - Security   ~
~  http://www.ultra-secure.de/~rainer/pubkey.pgp  ~
===


Re: [vchkpw] listing over-quota users

2005-03-10 Thread Charles Sprickman
On Wed, 9 Mar 2005 [EMAIL PROTECTED] wrote:
this method is of course fast and dirty, but it might not work for 
everyone out there.

the best aproach is to write a perl script that runs queries on a 
database, gets path to a user's mailbox on the server, uses File::Find 
to include only files in Maildir/cur and Maildir/new as well as 
:subfolders:/cur and :subfolders:/new with the exception of trash 
folders. that should give a much clearer picture. in addition it can 
scale better.
I have something similar, but it's not very generic, so I don't know if 
anyone would be interested.  I've added a few fields to the vpopmail table 
to record when they first hit quota so I can get a report (quick php page) 
of who's over and for how long.

To get usage, I'm just hitting the user's homedir with du, can you comment 
a bit on why I would need to count only the mail?  There shouldn't really 
be anything of note in the user's directory besides the mail...

It is quite interesting to see how much the "real" usage (provided by du) 
can differ from the maildirsize info.

Charles
--
Igor
On Wed, Mar 09, 2005 at 08:08:10AM -0800, Charles J. Boening wrote:
-> Here's what I do.  I don't have too many domains or users do it doesn't
-> take too long.
->
-> du -sk /home/vpopmail/domains/*/*/Maildir > /tmp/maildirusage && du -sk
-> /home/vpopmail/domains/*/*/*/Maildir >> /tmp/maildirusage && cat
-> /tmp/maildirusage | sort -n | tail -n50 | sort -n -r | mail -s "Mail
-> User Quota" 
->
->
-> This only gets the top 50 users.  You can change it easily.  I don't
-> think it would be very efficient for multiple domains.  In that case you
-> may want to break it up into a run for each domain.
->
-> I'd definitely like to see something more efficient :)
->
->
-> Charlie
->
->
->
-> 
->
->   From: Tanmaya Anand [mailto:[EMAIL PROTECTED]
->   Sent: Tuesday, March 08, 2005 11:44 PM
->   To: vchkpw@inter7.com
->   Subject: [vchkpw] listing over-quota users
->
->
->
->   Hi
->
->   I need to list all over-quota users on the system for all
-> domains.
->   Can anyone help me with some similiar perl / shell script to get
-> this done.
->
->   Regards,
->   Tanmaya
->
->
->
->
->
->


RE: [vchkpw] listing over-quota users

2005-03-10 Thread Charles J. Boening
How about the following the following

 | grep -v "^[0-9]%"

Should work.


Charlie



> -Original Message-
> From: Rainer Duffner [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 10, 2005 11:56 AM
> To: vchkpw@inter7.com
> Subject: Re: [vchkpw] listing over-quota users
> 
> Charles J. Boening wrote:
> 
> >How about this?
> >
> >
> >   #!/bin/sh
> >   for i in `/home/vpopmail/bin/vpopbull -n -V`;
> >  do echo `/home/vpopmail/bin/vuserinfo -Q $i` $i
> >   done
> >
> >
> >Called like this
> >/home/vpopmail/bin/overquota.sh  | grep "100%" | mail -s "Overquota 
> >users" 
> >
> >
> >  
> >
> 
> 
> Hey, that's nice.
> I added a |sort -n -r to get the list sorted by "top-offendes"
> How would I grep out every single-digit percentage ?
> 
> 
> 
> cheers,
> Rainer
> 
> --
> ===
> ~ Rainer Duffner - [EMAIL PROTECTED] ~
> ~   Freising - Munich - Germany   ~
> ~Unix - Linux - BSD - OpenSource - Security   ~
> ~  http://www.ultra-secure.de/~rainer/pubkey.pgp  ~ 
> ===
> 
> 
> 


Re: [vchkpw] listing over-quota users

2005-03-10 Thread Rainer Duffner
Charles J. Boening wrote:
How about this?

  #!/bin/sh
  for i in `/home/vpopmail/bin/vpopbull -n -V`;
 do echo `/home/vpopmail/bin/vuserinfo -Q $i` $i
  done

Called like this
/home/vpopmail/bin/overquota.sh  | grep "100%" | mail -s "Overquota
users" 
 


Hey, that's nice.
I added a |sort -n -r to get the list sorted by "top-offendes"
How would I grep out every single-digit percentage ?

cheers,
Rainer
--
===
~ Rainer Duffner - [EMAIL PROTECTED] ~
~   Freising - Munich - Germany   ~
~Unix - Linux - BSD - OpenSource - Security   ~
~  http://www.ultra-secure.de/~rainer/pubkey.pgp  ~
===


RE: [vchkpw] listing over-quota users

2005-03-09 Thread Charles J. Boening
How about this?


   #!/bin/sh
   for i in `/home/vpopmail/bin/vpopbull -n -V`;
  do echo `/home/vpopmail/bin/vuserinfo -Q $i` $i
   done


Called like this
/home/vpopmail/bin/overquota.sh  | grep "100%" | mail -s "Overquota
users" 


Charlie



> -Original Message-
> From: Tom Collins [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 09, 2005 4:52 PM
> To: vchkpw@inter7.com
> Subject: Re: [vchkpw] listing over-quota users
> 
> On Mar 9, 2005, at 6:15 PM, [EMAIL PROTECTED] wrote:
> > the best aproach is to write a perl script that runs queries on a 
> > database, gets path to a user's mailbox on the server, uses 
> File::Find 
> > to include only files in Maildir/cur and Maildir/new as well as 
> > :subfolders:/cur and :subfolders:/new with the exception of trash 
> > folders.
> > that should give a much clearer picture. in addition it can scale 
> > better.
> 
> How about using `vpopbull -n` (maybe `vpopbull -n -V`) to get 
> a list of email accounts and then `vuserinfo -Q 
> ` to get the quota usage?
> 
> I think that you could even use vuserinfo -d to get the path 
> to the user's maildir, delete the maildirsize file, and then 
> call vuserinfo -Q to have the file rebuilt.
> 
> --
> Tom Collins  -  [EMAIL PROTECTED]
> QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: 
> http://vpopmail.sf.net/ You don't need a laptop to 
> troubleshoot high-speed Internet: 
> sniffter.com
> 
> 
> 


Re: [vchkpw] listing over-quota users

2005-03-09 Thread Tom Collins
On Mar 9, 2005, at 6:15 PM, [EMAIL PROTECTED] wrote:
the best aproach is to write a perl script that runs queries on a 
database, gets path to a user's mailbox on the server, uses File::Find 
to include only files in Maildir/cur and Maildir/new as well as 
:subfolders:/cur and :subfolders:/new with the exception of trash 
folders.
that should give a much clearer picture. in addition it can scale 
better.
How about using `vpopbull -n` (maybe `vpopbull -n -V`) to get a list of 
email accounts and then `vuserinfo -Q ` to get the quota 
usage?

I think that you could even use vuserinfo -d to get the path to the 
user's maildir, delete the maildirsize file, and then call vuserinfo -Q 
to have the file rebuilt.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
You don't need a laptop to troubleshoot high-speed Internet: 
sniffter.com



Re: [vchkpw] listing over-quota users

2005-03-09 Thread green-vpopmail
this method is of course fast and dirty, but it might not work for everyone out 
there.

the best aproach is to write a perl script that runs queries on a database, 
gets path to a user's mailbox on the server, uses File::Find to include only 
files in Maildir/cur and Maildir/new as well as :subfolders:/cur and 
:subfolders:/new with the exception of trash folders.
that should give a much clearer picture. in addition it can scale better.

-- 
Igor


On Wed, Mar 09, 2005 at 08:08:10AM -0800, Charles J. Boening wrote:
-> Here's what I do.  I don't have too many domains or users do it doesn't
-> take too long.
-> 
-> du -sk /home/vpopmail/domains/*/*/Maildir > /tmp/maildirusage && du -sk
-> /home/vpopmail/domains/*/*/*/Maildir >> /tmp/maildirusage && cat
-> /tmp/maildirusage | sort -n | tail -n50 | sort -n -r | mail -s "Mail
-> User Quota" 
-> 
-> 
-> This only gets the top 50 users.  You can change it easily.  I don't
-> think it would be very efficient for multiple domains.  In that case you
-> may want to break it up into a run for each domain.
-> 
-> I'd definitely like to see something more efficient :)
-> 
-> 
-> Charlie
->  
-> 
-> 
-> 
-> 
->  From: Tanmaya Anand [mailto:[EMAIL PROTECTED] 
->  Sent: Tuesday, March 08, 2005 11:44 PM
->  To: vchkpw@inter7.com
->  Subject: [vchkpw] listing over-quota users
->  
->  
-> 
->  Hi
->  
->  I need to list all over-quota users on the system for all
-> domains. 
->  Can anyone help me with some similiar perl / shell script to get
-> this done.
->  
->  Regards,
->  Tanmaya 
-> 
-> 
-> 
->     
-> 
-> 


RE: [vchkpw] listing over-quota users

2005-03-09 Thread Charles J. Boening
Here's what I do.  I don't have too many domains or users do it doesn't
take too long.

du -sk /home/vpopmail/domains/*/*/Maildir > /tmp/maildirusage && du -sk
/home/vpopmail/domains/*/*/*/Maildir >> /tmp/maildirusage && cat
/tmp/maildirusage | sort -n | tail -n50 | sort -n -r | mail -s "Mail
User Quota" 


This only gets the top 50 users.  You can change it easily.  I don't
think it would be very efficient for multiple domains.  In that case you
may want to break it up into a run for each domain.

I'd definitely like to see something more efficient :)


Charlie
 




From: Tanmaya Anand [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 08, 2005 11:44 PM
To: vchkpw@inter7.com
Subject: [vchkpw] listing over-quota users



Hi

I need to list all over-quota users on the system for all
domains. 
Can anyone help me with some similiar perl / shell script to get
this done.

Regards,
Tanmaya