free data trial in mb

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 RouterOS - RouterOS - MikroTik Documentation. 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!

Hi, I’m looking for the same script, its all junk out there, I want all my trail users with a T- in front to be attached with the 100mb total data cap and after that 100mb is over, kick out… no luck for me, I cant believe mikotik haven’t yet added that under the 30min free trail setting, its sad