hotspot idle timeout

I’m sure this is an easy one, but I’m looking for a scrip to run every hour to locate any devices in the Hosts that are idle for more than 8 hours and remove them. We can’t just use idle-timeout since there are other devices in the host list like IP Bindings.
Thanks.

Any ideas on this? Any help would be great. Thanks.

try this
foreach i in=[ip hotspot host find ] do= {
local idle [ip hotspot host get value-name=idle-time $i]
local time 08:00:00
if ($idle > $time) do={
local mac [ip hotspot host get value-name=mac-address $i]
ip hotspot host remove $mac}}

Thanks for the reply, but I tried it under System > Scripts and ran it a few times, but nothing changes in the hosts file.
I’m not very familiar with scripting, but I’m still researching off of your example and a few others. If you have any other suggestions please let me know. Thanks.

paste directly in the terminal and check the output, and host too.

This works (tested with release 6.15):

foreach i in=[/ip hotspot host find ] do= {
local idle [/ip hotspot host get value-name=idle-time $i]
local time 00:05:00
if ($idle > $time) do={
ip hotspot host remove $i}}