Community discussions

MikroTik App
 
alfagius
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Mon Feb 21, 2011 4:07 pm

[Solved] Expired user-manager users.

Thu Mar 03, 2011 11:26 am

Hi,

Looked for his around forum but didn't manage to find anything about it.

Once an activated account is over its validity period, is it automatically removed from the userlist?

My issue is, I create around 200+ users a week on the system (it's a hotel) and I don't want to end up clocking 1000's of expired users.

If not, is there an easy way to clear them manually?

Thanks.
Last edited by alfagius on Fri Jun 03, 2011 2:29 pm, edited 1 time in total.
 
usmany
Member Candidate
Member Candidate
Posts: 142
Joined: Sun Dec 20, 2009 3:20 pm
Location: Nigeria
Contact:

Re: Expired users

Tue Mar 08, 2011 5:11 pm

Hi,

Looked for his around forum but didn't manage to find anything about it.

Once an activated account is over its validity period, is it automatically removed from the userlist?

My issue is, I create around 200+ users a week on the system (it's a hotel) and I don't want to end up clocking 1000's of expired users.

If not, is there an easy way to clear them manually?

Thanks.
I am searching for same answer from the mikrotik gurus on how to automatically delete old/expired users account from database.
When the world turn back on you, you turn your back on the world...
 
alfagius
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Mon Feb 21, 2011 4:07 pm

Re: Expired users

Wed Mar 30, 2011 4:08 pm

nothing from anybody?? :(
 
User avatar
marioclep
Trainer
Trainer
Posts: 140
Joined: Sat Jul 11, 2009 4:36 pm
Location: Cordoba - Argentina
Contact:

Re: Expired users

Thu Mar 31, 2011 4:31 pm

Hi,

When do you consider an account has reached the validity period? If it is by uptime, or some of the statics of the HotSpot User, then you can use some script to find those users who has reached those limits, and delete them automatically.

Regards
---------------------

Ing. Mario D. Clep
CTO - MKE Solutions
MikroTik Certified Trainer
 
usmany
Member Candidate
Member Candidate
Posts: 142
Joined: Sun Dec 20, 2009 3:20 pm
Location: Nigeria
Contact:

Re: Expired users

Thu Mar 31, 2011 5:51 pm

Hi,

When do you consider an account has reached the validity period? If it is by uptime, or some of the statics of the HotSpot User, then you can use some script to find those users who has reached those limits, and delete them automatically.

Regards
so how can we use the script and what is the script or look like (syntax) pls
When the world turn back on you, you turn your back on the world...
 
fewi
Forum Guru
Forum Guru
Posts: 7734
Joined: Tue Aug 11, 2009 3:19 am

Re: Expired users

Thu Mar 31, 2011 6:00 pm

That depends on your answers to his questions...
Specific answers require specific questions. When in doubt, post the output of "/ip address print detail", "/ip route print detail", "/interface print detail", "/ip firewall export", and an accurate network diagram.
 
usmany
Member Candidate
Member Candidate
Posts: 142
Joined: Sun Dec 20, 2009 3:20 pm
Location: Nigeria
Contact:

Re: Expired users

Thu Mar 31, 2011 6:03 pm

That depends on your answers to his questions...
his question? we consider it by uptime of 3d period.
When the world turn back on you, you turn your back on the world...
 
User avatar
marioclep
Trainer
Trainer
Posts: 140
Joined: Sat Jul 11, 2009 4:36 pm
Location: Cordoba - Argentina
Contact:

Re: Expired users

Thu Mar 31, 2011 6:58 pm

I'm not expert in scripting, but you may need something which contains "rem [find (uptime=3d)]", under /ip hotspot users... (please scripting experts, forgive my syntax, Im just making the point)
---------------------

Ing. Mario D. Clep
CTO - MKE Solutions
MikroTik Certified Trainer
 
sleimanr
Member Candidate
Member Candidate
Posts: 176
Joined: Mon Oct 18, 2010 9:31 am

Re: Expired users

Sun Apr 03, 2011 1:48 am

hi all,
i'm using pppoe.
 
User avatar
routik
Member Candidate
Member Candidate
Posts: 120
Joined: Wed Oct 14, 2009 5:40 pm
Location: Abuja-Nigeria
Contact:

Re: Expired users

Wed Jun 01, 2011 11:38 am

the solution of scripts that will be deleting expired/uptime tickets have not been provided. please i need it as well.
I enjoy building broadband network with @Mikrotik
 
alfagius
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Mon Feb 21, 2011 4:07 pm

Re: Expired users

Thu Jun 02, 2011 2:59 pm

I have figured it out finally after a day of banging my head on the keyboard.

Working on a lengthy script that removes any user whos credit-till-time is less than today's date.

Still ironing out a few bugs, but will post it as soon as it's 100% working. :D
 
alfagius
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Mon Feb 21, 2011 4:07 pm

Re: Expired users

Fri Jun 03, 2011 2:06 pm

And here you go.

Script finished and tested. Posted on the Scripting section for whoever needs it: http://forum.mikrotik.com/viewtopic.php?f=9&t=52261

Please note that this applies for users in the user-manager package database, not standard Mikrotik hotspot user lists.
 
nepal
newbie
Posts: 26
Joined: Thu Apr 11, 2013 10:42 am

Re: [Solved] Expired user-manager users.

Thu Apr 11, 2013 10:49 am

might be useful

:foreach a in=[/tool user-manager user find] do={:if ([/tool user-manager user get $a credit-left]=0s) do={
:log warning ("deleted Expired user.. $[/tool user-manager user get $a name]")
/tool user-manager user remove [/tool user-manager user get $a name]
}}
 
gtpro
newbie
Posts: 36
Joined: Thu Jun 03, 2010 9:05 pm

Re: [Solved] Expired user-manager users.

Fri Apr 12, 2013 2:49 am

If Nepals script does not work try this

Tested on version 5.24
:foreach i in=[/tool user-manager user find] do={:if ([/tool user-manager user get $i uptime-used]= 1h) do={
:log warning ("deleted Expired user.. $[/tool user-manager user get $i name]")
/tool user-manager user remove [/tool user-manager user get $i name]
}
}
It works for me deleting users with the uptime limit reached.
 
User avatar
leemans
Frequent Visitor
Frequent Visitor
Posts: 61
Joined: Thu Apr 07, 2005 12:55 am
Location: Belgium
Contact:

Re: [Solved] Expired user-manager users.

Sun May 12, 2013 2:24 pm

Dear Newbie,

Can you update your script that it can work with these parameters?

last-seen is < today
and Uptime-Used>0
and Till-time=Unknown
and Total-Time-Left=""
and Time-Left=""

Thanks in advance.
Patrick

Who is online

Users browsing this forum: No registered users and 10 guests