Hi everyone,
I made a simple hotspot configuration using the wiki installation on page
http://wiki.mikrotik.com/wiki/How_to_make_a_HotSpot_gateway
I only have 1 type of user which expires at 1 day. I made several users (login codes) using:
/ip hotspot user add name=94399701 limit-uptime=1d profile=“HS 1 day”
/ip hotspot user add name=31514893 limit-uptime=1d profile=“HS 1 day”
/ip hotspot user add name=81920931 limit-uptime=1d profile=“HS 1 day”
/ip hotspot user add name=23458740 limit-uptime=1d profile=“HS 1 day”
/ip hotspot user add name=92689757 limit-uptime=1d profile=“HS 1 day”
So, login code (user) 94399701 with limit-uptime 1 day expires at 24 hours.
My question is: is there a possibily to delete these users automatically after the expiration?
Thanks in advance
make a script to check expired accounts and if found delete user. I run my script on scheduler every 12:00 mn.
Hope this helps
anyway I can get this script ?
here goes:
:log message=“Delete used account script executed”
:local x
:set x 0
:foreach i in [/ip hotspot user find profile=“prepaid”] do={
:if ([/ip hotspot user get $i uptime]>=[/ip hotspot user get $i limit-uptime]) do={/ip hotspot user remove $i
:incr x}
}
:if ($x=0) do={:log message=“No user account deleted”}
make this script on the scheduler and start at it at 00:00 and interval 24:00
good luck!
Robert
Hi, I am vicky, I am new to MikroTik RouterOS. I need help similar to this. I am giving a free wifi for 2hours to people to use internet. I have a profile with Session Timeout 2hours and MAC Cookie Timeout 2hours. And in Users i create Users with LimitUp Time 2hours. I need to make users to connect only 2hours per day. Can u please Help me.
Thanks
Vicky
Hotspot in the mikrotik and the trouble of deleting Usenet (users or cards)
The solution is easy. The scan will be done automatically
Roll Delete accounts ended time
{
:local time 2h;
:foreach i in=[/ip hotspot user find where uptime=$time and limit-uptime=$time] do={
:local ahmedalimi [/ip hotspot user remove $i];
}
}
Just change the 2h time you specify for the downloads to delete all accounts ended by this time used automatically.
Roll Delete Accounts Finished Download
{
: local mega 100;
: local byte 1048576;
: local bytes ($ byte * $ mega);
: foreach i in = [/ ip hotspot user find where bytes-out = $ bytes and limit-bytes-out = $ bytes] do = {
: local ahmedalimi [/ ip hotspot user remove $ i];
}
}
Just change the 100 to the amount of load you have specified for the downloads to delete all accounts ending by this value used automatically.
Roll Delete Accounts Finished Download + Upload Total data quantity limit-bytes-total
{
: local mega 100;
: local byte 1048576;
: local bytes ($ byte * $ mega);
: foreach i in = [/ ip hotspot user find] do = {
: local out [/ ip hotspot user get $ i bytes-out];
: local in [/ ip hotspot user get $ i bytes-in];
: local total ($ out + $ in);
: if ($ total = $ bytes) do = {
/ ip hotspot user remove $ i;
}
}
}
Just change the 100 to the amount of upload and upload you specified for the downloads to delete all accounts ended by this value used automatically.
https://tawasol4sy.org/mikrotik-hotspot-delete-users-automatically/