How to reset weekly counter every Sunday midnight?
Lee Sing Chyun
singchyun at gmail.com
Thu Nov 22 11:17:37 CET 2007
Hi, I'm trying unsuccessfully to configure a sqlcounter that is reset every
Sunday 0:00AM. Here's what i configured in radiusd.conf:
sqlcounter weeklycounter {
counter-name = Weekly-Session-Time
check-name = Max-Weekly-Session
reply-name = Session-Timeout
sqlmod-inst = sql
key = User-Name
reset = weekly
# For mysql:
query = "SELECT SUM(AcctSessionTime - \
GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0)) \
FROM radacct WHERE UserName='%{%k}' AND \
UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
}
After that, I did a radtest. From the resulting SQL trace, I notice "%b" is
expanded as 7 days earlier than today. For instance, when running radtest on
20 Nov 2007 1:16AM (a Tuesday), "%b" gets expanded to 13 Nov 2007 0:00AM (a
Tuesday too), which is not my desired outcome.
How do I configure a sqlcounter that is reset every Sunday midnight? Thanks
in advance, and sorry if there're any obvious mistakes that I have
overlooked.
--
sc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20071122/5f50ca17/attachment.html>
More information about the Freeradius-Users
mailing list