Community discussions

MikroTik App
 
dana1975
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 94
Joined: Sat Jul 04, 2009 8:32 pm

Kick Duplicate hotspot users

Tue Apr 21, 2015 11:44 am

i have 3 hotspot on a mikrotik and all of them connecting to radius server (windows 2008) and i cannot use shared users because it will assign to local users only and im not using usermanager as well.
is there any script to run and kick duplicate users in 2 hotspot only ? because the third hotpost is multisession
 
dana1975
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 94
Joined: Sat Jul 04, 2009 8:32 pm

Re: Kick Duplicate hotspot users

Wed Apr 22, 2015 5:58 pm

i found this script, but i have 3 hotspot and i need to kick duplicate users only for 2 hotspot, the users of thid hotspot can login more than one time
how can i check the hotspot name this script??


:local uname $user;
:local usercount 0;
:local usertime "00:00:00";
:local kickable;
:local maxuser 2;

:if (
:foreach i in=[/ip hotspot active find user=$uname] do= {
:local curup [/ip hotspot active get $i uptime];
:if ( $curup > $usertime ) do={
:set usertime $curup;
:set kickable $i;
}
:set usercount ($usercount+1);
}
:if ($usercount >= $maxuser) do={
:log info "Login user: $uname ($usercount/$maxuser) - Oldest $usertime will be logout!";
/ip hotspot active remove numbers=$kickable;
} else {
:log info "Login user: $uname ($usercount/$maxuser)";
}
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Kick Duplicate hotspot users

Wed Apr 22, 2015 6:02 pm

At the very first step, filter out the users that are not on the 3rd hotspot server, i.e. replace
:foreach i in=[/ip hotspot active find user=$uname] do= {
with
:foreach i in=[/ip hotspot active find user=$uname && server!=hotspot3] do= {
 
dana1975
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 94
Joined: Sat Jul 04, 2009 8:32 pm

Re: Kick Duplicate hotspot users

Thu May 14, 2015 8:39 am

thank you so much, it's work perfect now.

Who is online

Users browsing this forum: No registered users and 17 guests