Community discussions

 
SapieH
newbie
Topic Author
Posts: 48
Joined: Wed May 13, 2009 9:44 pm

Hotspot user removal by script

Tue Jul 22, 2014 10:24 am

I need a script that will remove all hotspot users at 00:00 every night. My hotspot is running on Ros6.15
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2946
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: Hotspot user removal by script

Tue Jul 22, 2014 9:34 pm

What do you intend for "remove"?

Disconnect or delete all users made?

if is the last case, supposing you use user-manager, schedule this at each midnight:
/tool user-manager user remove [find];
/tool user-managersession remove [find];
/tool user-manager database clear-log;
/tool user-manager database rebuild;
/system reboot;
If you paste this on console ask yes or not, but if you put on script, do not ask anything and go.
I'm Italian, not English. Sorry for my imperfect grammar.
 
SapieH
newbie
Topic Author
Posts: 48
Joined: Wed May 13, 2009 9:44 pm

Re: Hotspot user removal by script

Wed Jul 23, 2014 7:59 am

Thank you for your suggestion. I am not using usermanager. I need to delete all entries under the user list in Hotspot. The reason for this is that hotspot users get 400mb free and thereafter they need to purchase access through the portal on the landing page. I have a script in place to remove all users that have reached their quota and this is scheduled to run at midnight. This is the one I have tried to clear all users but it does not work :foreach counter in=[/ip hotspot user find ] do={/ip hotspot user remove}
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2946
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: Hotspot user removal by script

Wed Jul 23, 2014 8:44 am

Thank you for your suggestion. I am not using usermanager. I need to delete all entries under the user list in Hotspot. The reason for this is that hotspot users get 400mb free and thereafter they need to purchase access through the portal on the landing page. I have a script in place to remove all users that have reached their quota and this is scheduled to run at midnight. This is the one I have tried to clear all users but it does not work :foreach counter in=[/ip hotspot user find ] do={/ip hotspot user remove}
If you see what I have writed, you can deduce to do this:
/ip hotspot user remove [find];
I'm Italian, not English. Sorry for my imperfect grammar.
 
SapieH
newbie
Topic Author
Posts: 48
Joined: Wed May 13, 2009 9:44 pm

Re: Hotspot user removal by script

Fri Aug 08, 2014 5:23 pm

Thanx rextended! Working well :D
 
kraker
Frequent Visitor
Frequent Visitor
Posts: 88
Joined: Thu Aug 02, 2012 9:34 am

Re: Hotspot user removal by script

Tue Aug 12, 2014 1:44 pm

Hi Sapieh;

We want to delete session time out users (when session timeout)at mikrotik hotspot users.Is there any way to do this?

thanks...
 
SapieH
newbie
Topic Author
Posts: 48
Joined: Wed May 13, 2009 9:44 pm

Re: Hotspot user removal by script

Tue Aug 12, 2014 10:29 pm

Paste this into a terminal on your Router board and schedule it to run at midnight
add name="Clear users" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
source="/ip hotspot user remove [find];"
 
User avatar
linuchero
just joined
Posts: 7
Joined: Wed Sep 21, 2011 8:23 am

Re: Hotspot user removal by script

Sat Jun 11, 2016 11:07 pm

l need a script for removing users from user manager but only users whose have finished their uptime please!!!
 
danjeneth
just joined
Posts: 1
Joined: Mon Aug 07, 2017 3:03 am

Re: Hotspot user removal by script

Tue Sep 12, 2017 4:38 pm

can someone knows the script please help us i need it too thanks

Who is online

Users browsing this forum: No registered users and 5 guests