Free data issues

Shnorkiller

Well-Known Member
Joined
Jul 26, 2012
Messages
297
Reaction score
0
Hi all,

I'm trying to setup a basic hotspot trial using mikrotik. The issue is that the only option i have on the equipment is a time based trial and not a data based trial. I'm wanting to give 50 mb free per day.

Here is the script i found at http://wiki.mikrotik.com/wiki/Add_a_data_limit_to_trial_hotspot_users. The issue is that it kicks everyone off as soon as the script runs and not after they have reached the 50mb limit. I have run the script at various time intervals (1 min, 5 mins, 10 mins) and yet the same thing happens every time. I'm no good with script, so if anyone has any advise/reason as to why this issue keeps happening, please let me know.

#Download limit in MB
:local downquotamb "50"

### Do not modify anything below this line ###
:local downquota [$downquotamb * 1000]
:local counter
:local datadown
:local username
:local macaddress
:foreach counter in=[/ip hotspot active find ] do={
:set datadown [/ip hotspot active get $counter bytes-out]
:if ($datadown>$downquota) do={
:set username [/ip hotspot active get $counter user]
:set macaddress [/ip hotspot active get $counter mac-address]
/ip hotspot user remove [/ip hotspot user find where name=$username]
/ip hotspot user add name=$username limit-bytes-out=$downquota mac-address=$macaddress
/ip hotspot active remove $counter
:log info "Logged out $username - Reached download quota"
}}

Thanks so much for the assistance!
 
Top
Sign up to the MyBroadband newsletter
X