Community discussions

MikroTik App
 
Arco van Bezooijen
newbie
Topic Author
Posts: 31
Joined: Sat Feb 05, 2005 1:33 pm
Location: The Netherlands
Contact:

Wifi hotspot question, deleting users after expiration

Wed Jul 05, 2006 12:21 pm

Hi everyone,

I made a simple hotspot configuration using the wiki installation on page

http://wiki.mikrotik.com/wiki/How_to_ma ... ot_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
 
User avatar
infomate
Member Candidate
Member Candidate
Posts: 114
Joined: Sat May 21, 2005 2:30 pm
Location: Dumaguete City, Philippines

Thu Jul 20, 2006 4:06 pm

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
 
Arco van Bezooijen
newbie
Topic Author
Posts: 31
Joined: Sat Feb 05, 2005 1:33 pm
Location: The Netherlands
Contact:

Thu Jul 20, 2006 4:09 pm

anyway I can get this script ?
 
User avatar
infomate
Member Candidate
Member Candidate
Posts: 114
Joined: Sat May 21, 2005 2:30 pm
Location: Dumaguete City, Philippines

Fri Jul 21, 2006 3:45 am

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
 
vigneshsvn
just joined
Posts: 1
Joined: Wed Oct 28, 2015 3:29 pm

Re: I am new to MikroTik RouterOS. I need help similar to this.

Tue Feb 23, 2016 9:27 am

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
 
tawasol4sy
just joined
Posts: 4
Joined: Thu Jul 05, 2018 6:30 am
Contact:

Re: Wifi hotspot question, deleting users after expiration

Wed Aug 15, 2018 9:12 pm

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 ... matically/

Who is online

Users browsing this forum: No registered users and 20 guests