You can do mysql stuff with shell. Just make sure it's only readable
by root or some other privileged user.
This snippet deletes guest accounts in my freeradius radcheck table
when they hit a certain age. I use it for a guest wireless network.
This has nothing to do with bandwidth use, but should give you some
insight into how to whip up a mysql command in bash or some other shell.
mysql="/usr/bin/mysql --user=$user --password=$password $database"
time=`echo "select now() - 120000" | $mysql | tail -1`
echo "delete from radcheck where Username REGEXP 'guest' AND created
< $time" | $mysql
-charles
On 06/07/2010 07:43 PM, Tony Zhou wrote:
Geez, I'm not that familiar with PHP.
Could you please give a more detailed sample?
2010/6/7 yegle <address@hidden>
PHP
can do this.
On Tue, Jun 8, 2010 at 10:40 AM, Tony Zhou
<address@hidden>
wrote:
I know what crontab
is, but not quite sure how should use a script to read from SQL
database.
What type of script
do you use? Perl? Or just simple shell script?
Thanks.
From: yegle [mailto:address@hidden]
Sent: Monday, June 07, 2010 10:38 PM
To: address@hidden
Cc: address@hidden
Subject: Re: Re: [Radiusplugin-users] Anyone knows how to
use Radiusplugin to limit client's traffic?
well...You
should remember to reply all...
You need to know what crontab is, which script language can be used for
accessing postgresql.
Do a crontab every hour to check sum of traffics every user generated
and either delete user from radcheck table or set there password to
random ones.Here I assume you are using the table schema from
freeradius.
the code can be like this:
for each user:
traffic = sum(acctinputoctets+acctoutputoctets) where acctstarttime
>= the beginning of this month
quota = user's quota
if (traffic>=quota) then
delete this user
(or) change user password to sOmEThinGUnreAdable
end for
On Tue, Jun 8, 2010 at 10:11 AM, <address@hidden> wrote:
Exactly how?
On Jun 7, 2010 9:59pm, yegle <address@hidden>
wrote:
> Use crontab to delete/deactivate user when the monthly traffic
exceeded.
>
> On Tue, Jun 8, 2010 at 9:56 AM, Tony Zhou address@hidden> wrote:
>
> Hi all,
> I'm running Freeradius 2.1+Postgresql 8.4.4+OpenVPN on Ubuntu
9.10 x86. It runs smoothly now, however, I want to know that if there
is any way to limit per user's traffic, like 10G/month, and
disconnect/reject their connection when the limitation has been reached.
> I have asked this on FreeRADIUS maillist and they said that is
NAS client related. Is there any function in Radiusplugin or any
additional script could do this?
> Thanks in advance.
>
>
> _______________________________________________
>
> Radiusplugin-users mailing list
>
> address@hidden
>
> http://lists.nongnu.org/mailman/listinfo/radiusplugin-users
>
>
>
>
>
_______________________________________________
Radiusplugin-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/radiusplugin-users
|