One counting period meaning beginning of month?
Month, week, day, doesn't matter. Query is the same for all.
So it should be:
query = "SELECT SUM(AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) > '%b'"
If I want to allow users say 1Gb per month limit that gets reset every month. (In other words no cary over of data)
And: query = "SELECT SUM(AcctInputOctets + AcctOutputOctets) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
If I want them to be able to use there unused data from previous month + new data limit?
No. Not unused but data used in a session that started in one period and continued into the next one. Lets say today is the last of the month. User starts the session today and finishes tomorrow morning. Is that data counting towards the new months limit? Or not? If it does leave AcctSessionTime in, if it doesn't - take it out. If you want to carry over unused allowance you alter the check-name parameter. Instead of that value being constant (1GB in your example) you would add whatever is left from previous month and insert that as the value for the counter. Ivan Kalik Kalik Infromatika ISP