Page 1 of 1
Hotspot user removal by script
Posted: Tue Jul 22, 2014 10:24 am
by SapieH
I need a script that will remove all hotspot users at 00:00 every night. My hotspot is running on Ros6.15
Re: Hotspot user removal by script
Posted: Tue Jul 22, 2014 9:34 pm
by rextended
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.
Re: Hotspot user removal by script
Posted: Wed Jul 23, 2014 7:59 am
by SapieH
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}
Re: Hotspot user removal by script
Posted: Wed Jul 23, 2014 8:44 am
by rextended
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];
Re: Hotspot user removal by script
Posted: Fri Aug 08, 2014 5:23 pm
by SapieH
Thanx rextended! Working well
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Re: Hotspot user removal by script
Posted: Tue Aug 12, 2014 1:44 pm
by kraker
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...
Re: Hotspot user removal by script
Posted: Tue Aug 12, 2014 10:29 pm
by SapieH
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];"
Re: Hotspot user removal by script
Posted: Sat Jun 11, 2016 11:07 pm
by linuchero
l need a script for removing users from user manager but only users whose have finished their uptime please!!!
Re: Hotspot user removal by script
Posted: Tue Sep 12, 2017 4:38 pm
by danjeneth
can someone knows the script please help us i need it too thanks