How to reset weekly counter every Sunday midnight?
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
This archive was generated by a fusion of
Pipermail (Mailman edition) and
MHonArc.