Community discussions

MikroTik App
 
FRANKMUNOZAPURE
just joined
Topic Author
Posts: 21
Joined: Thu May 23, 2024 11:57 am

Script to delete user in "IP DHCP SERVER LEASES"

Sun Jun 30, 2024 11:12 pm

Greetings gentlemen, I have a script that eliminates the clients connected to the HOTSPOT and it works very well for me, but I would like that same script to also eliminate that user in IP DHCP SERVER LEASES, I need your help, thanks in advance. Here I leave the script.
:local comment "IN USE"
:local userprofile [ip hotspot user get [find where name="$user"] profile]

:if ([/ip hotspot user get $user comment]="") do={[/ip hotspot user set $user comment=$comment]}

[/system scheduler 
add comment= [/ip hotspot user profile get [find where name="$userprofile"] name] name=$user on-event="/ip hotspot user remove \"$user\" \r\
  \n/system scheduler remove [find where name=\"$user\"] \r\
  \n\r\
" interval= [/ip hotspot user profile get [find where name="$userprofile"] session-timeout]]
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12861
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script to delete user in "IP DHCP SERVER LEASES"

Mon Jul 01, 2024 10:12 am

Is not easyer set the DHCP timeout to 10 min?
 
FRANKMUNOZAPURE
just joined
Topic Author
Posts: 21
Joined: Thu May 23, 2024 11:57 am

Re: Script to delete user in "IP DHCP SERVER LEASES"

Mon Jul 01, 2024 2:08 pm

Thanks for responding REX, but what would the script be like?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12861
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script to delete user in "IP DHCP SERVER LEASES"

Mon Jul 01, 2024 11:04 pm

Seriously?
 
FRANKMUNOZAPURE
just joined
Topic Author
Posts: 21
Joined: Thu May 23, 2024 11:57 am

Re: Script to delete user in "IP DHCP SERVER LEASES"

Tue Jul 02, 2024 1:54 am

REX. I need help with this script please
 
User avatar
nichky
Forum Guru
Forum Guru
Posts: 1401
Joined: Tue Jun 23, 2015 2:35 pm

Re: Script to delete user in "IP DHCP SERVER LEASES"

Tue Jul 02, 2024 3:27 am

brother, read above what @rextended adviced.

No one is willing to write a complicated script something if the solution is with one click (already explained)
 
FRANKMUNOZAPURE
just joined
Topic Author
Posts: 21
Joined: Thu May 23, 2024 11:57 am

Re: Script to delete user in "IP DHCP SERVER LEASES"

Fri Jul 05, 2024 3:26 am

Can anybody help me please.

I will thank you eternally.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12861
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script to delete user in "IP DHCP SERVER LEASES"

Fri Jul 05, 2024 4:16 pm

To me you're kidding us.