Page 1 of 1

[Solved] Expired user-manager users.

Posted: Thu Mar 03, 2011 11:26 am
by alfagius
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.

Re: Expired users

Posted: Tue Mar 08, 2011 5:11 pm
by usmany
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.

Re: Expired users

Posted: Wed Mar 30, 2011 4:08 pm
by alfagius
nothing from anybody?? :(

Re: Expired users

Posted: Thu Mar 31, 2011 4:31 pm
by marioclep
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

Re: Expired users

Posted: Thu Mar 31, 2011 5:51 pm
by usmany
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

Re: Expired users

Posted: Thu Mar 31, 2011 6:00 pm
by fewi
That depends on your answers to his questions...

Re: Expired users

Posted: Thu Mar 31, 2011 6:03 pm
by usmany
That depends on your answers to his questions...
his question? we consider it by uptime of 3d period.

Re: Expired users

Posted: Thu Mar 31, 2011 6:58 pm
by marioclep
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)

Re: Expired users

Posted: Sun Apr 03, 2011 1:48 am
by sleimanr
hi all,
i'm using pppoe.

Re: Expired users

Posted: Wed Jun 01, 2011 11:38 am
by routik
the solution of scripts that will be deleting expired/uptime tickets have not been provided. please i need it as well.

Re: Expired users

Posted: Thu Jun 02, 2011 2:59 pm
by alfagius
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

Re: Expired users

Posted: Fri Jun 03, 2011 2:06 pm
by alfagius
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.

Re: [Solved] Expired user-manager users.

Posted: Thu Apr 11, 2013 10:49 am
by nepal
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]
}}

Re: [Solved] Expired user-manager users.

Posted: Fri Apr 12, 2013 2:49 am
by gtpro
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.

Re: [Solved] Expired user-manager users.

Posted: Sun May 12, 2013 2:24 pm
by leemans
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