need help with script to delete users after reaching uptime

Hello, I am trying to use the scripting example with no success. Instead of just removing hotspot users that have reached their uptime the script is removing all users. Here is what I am using:

/ system script add name=“delete_user” source={
:foreach i in [/ip hotspot user find profile=default] do={
:if ([/ip hotspot user get $i limit-uptime]<=[/ip hotspot user get $i
uptime]) do={
/ip hotspot user remove $i
}
}
}



Any help would be appreciated, thanks.

Hi! It seems you kick the profile “default” rather than the user (secrets).

Try this:

/ system script add name=“delete_user” source={
:foreach i in [/ip hotspot user find secret=tommy] do={
:if ([/ip hotspot user get $i limit-uptime]<=[/ip hotspot user get $i
uptime]) do={
/ip hotspot user remove $i
}
}
}

Mail me if you don’t come right.
giepie@varynet.co.za