Login Script:
# Set Default Rate Limit k/s #Set User # Set User Profile
:global DRateLimit "9000"
:global UName "asd"
:global ProName "MultiShare_Pro"
# Remove Default Queue
/queue simple remove [/queue simple find name~"$UName"]
# Count Login Device
:local DeviceCount [/ip hotspot active print count-only where user=$UName]
# Set Queue Per Device
:local QPerDevice ($DRateLimit / $DeviceCount)
# Add Queue to New Login Device
/queue simple add name=$address target=$address max-limit=($QPerDevice."k/".$QPerDevice."k") comment=$user place-before=0;
# Reset Queue to Logined Device
:foreach QReset in=[/queue simple find comment =$UName] do={/queue simple set $QReset max-limit=($QPerDevice."k/".$QPerDevice."k")}
#PhallaCCMT.blogspot.com
Logout Scrip:
# Remove Queue From Logout Device
/queue simple remove [/queue simple find name =$address]
# Count Device Login
:local DeviceCount [/ip hotspot active print count-only where user=$UName]
# --------------------if all Device Logout
:if ($DeviceCount =0) do={
:log info "All are Devices Logout :D"
}\
else={
# Set Queue Per Device
:local QPerDevice ($DRateLimit / $DeviceCount)
# Reset Queue to Logined Device
:foreach QReset in=[/queue simple find comment =$UName] do={/queue simple set $QReset max-limit=($QPerDevice."k/".$QPerDevice."k")}
}
#PhallaCCMT.blogspot.com
3 comments
Write commentsdear,
Replycan I , combine this scrip with limit youtube or download?
Hi .
ReplyWill You Send Me 4 Wan Load Balancing script for Mikrotik Hotspot Server...
Thank you ...
bandwidth limit calculation only work if user logout from "logout" button,
Replybandwidth not recalculated if they had autologout (example : loss connection)
can you fix this bug?
EmoticonEmoticon