Where are the List Accounts quota stored

gearheadhost

Member
Jun 14, 2009
14
0
51
I have been trying to find the file that shows the disk usage that is listed in the List Accounts on and off for the last week. Basically I want to be able to cat or grep that file from within ssh without going to the WHM. I can work so much faster in ssh than in WHM and it would make things alot easier to do it that way.

Also when a vps node goes over quota the list accounts seems to fail to list anything and I can't see where the big file usage is via that so I need ssh to do it and du takes forever.

Any assistance is much appreciated.
 

chinmay

Well-Known Member
Jul 22, 2008
101
0
66
localhost
I have been trying to find the file that shows the disk usage that is listed in the List Accounts on and off for the last week. Basically I want to be able to cat or grep that file from within ssh without going to the WHM. I can work so much faster in ssh than in WHM and it would make things alot easier to do it that way.

Also when a vps node goes over quota the list accounts seems to fail to list anything and I can't see where the big file usage is via that so I need ssh to do it and du takes forever.

Any assistance is much appreciated.
The quota file "quota_-v" is located at "/home/cPanel_username/.cpanel/datastore".

Note :: Replace cPanel_username with actual username

Hope this is what you were looking for ;)
 

thewebhosting

Well-Known Member
May 9, 2008
1,201
1
68
Also when a vps node goes over quota the list accounts seems to fail to list anything and I can't see where the big file usage is via that so I need ssh to do it and du takes forever.
Run script /scripts/fixquotas. It will help to fix Cpanel when the user quotas aren't reading properly or showing unlimited for all user accounts.
 

gearheadhost

Member
Jun 14, 2009
14
0
51
The quota file "quota_-v" is located at "/home/cPanel_username/.cpanel/datastore".

Note :: Replace cPanel_username with actual username

Hope this is what you were looking for ;)
This is EXACTLY what I have been searching for... Now to write me up a little script so I can indes these over the entire server and things will be just super.

Great help thank you.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
The quota file "quota_-v" is located at "/home/cPanel_username/.cpanel/datastore".

Note :: Replace cPanel_username with actual username

Hope this is what you were looking for ;)
The quota_-v file is not used by List Accounts. That file only gets updated when a user logs into the cPanel interface. If you have accounts that rarely login then the value in the quota_-v will be stale and inaccurate.

List Accounts calls the quota command directly and parses the output for display.
 

gearheadhost

Member
Jun 14, 2009
14
0
51
The quota_-v file is not used by List Accounts. That file only gets updated when a user logs into the cPanel interface. If you have accounts that rarely login then the value in the quota_-v will be stale and inaccurate.

List Accounts calls the quota command directly and parses the output for display.
Well that is better than the above... What is the quotas command that cPanel's list accounts uses? I'm not as much of a linux ninja as others.
 

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,488
35
158
cPanel Access Level
DataCenter Provider
You could get it programmatically with this:

perl -I/usr/local/cpanel -MCpanel::SysQuota -MData::Dumper -e "print Dumper(Cpanel::SysQuota::analyzerepquotadata())"
 

gearheadhost

Member
Jun 14, 2009
14
0
51
End result accomplished...

So it may be a little ghetto in the end but this is what I was trying to create in the end.

http://www.gearheadhost.com/usage

Code:
mkdir /quotaRunner/

echo "Getting the quotas... This could take some time"

perl -I /usr/local/cpanel -MCpanel::SysQuota -MData::Dumper -e "print Dumper(Cpanel::SysQuota::analyzerepquotadata())" > /quotaRunner/quotas

for users in `cat /etc/trueuserdomains | cut -f2 -d :`
do
grep -n $users /quotaRunner/quotas | head -1 >> /quotaRunner/lineNumbers
done

for quotas in `cat /quotaRunner/lineNumbers | cut -f1 -d :`
do
sed -n $quotas'p' /quotaRunner/quotas | cut -f1 -d ,
done

rm -rf /quotaRunner/
If you want to run this on your server run
wget http://www.gearheadhost.com/usage ; sh usage

Many thanks to Kenneth and especially Nick. Without you two this would have first been built on old data (Kenneth ftw) and second would have never been completed (Nick ftw).