Restart when no active hotspot users?

Hi there,
I’m looking for a method to restart my RB’s when there are no active hotspot users, on a weekly base.
If at the point of the restart schedule there are users, it keeps trying every 15 minutes to see if there are any active users.

Could someone help me with creating this please? I think it would be a great addition to the wiki as many people need to start their RB’s to keep them fresh!

add a script

{
local user [len [ip hotspot active find]]
if ($user=0) do={/system reboot}
}

and then a scheduler for run the script

Thank you very much for that. Karma +1

Is there anyway I can add a range/address IP in the hotspot to exclude in that script?