[MIKROTIK] REMOVE USER SCRIPT - fourslickz/notes GitHub Wiki
:foreach u in=[/ip/hotspot/user/find] do={
:local username [/ip/hotspot/user/get $u name]
:local uptime [/ip/hotspot/user/get $u uptime]
:local profile [/ip/hotspot/user/get $u profile]
# hanya tampilkan kalau profile tidak kosong
:if ($profile != "") do={
:local pId [/ip/hotspot/user/profile/find where name=$profile]
:if ([:len $pId] > 0) do={
:local timeout [/ip/hotspot/user/profile/get $pId session-timeout]
# hanya tampilkan kalau timeout tidak kosong
:if ($timeout != "") do={
:if ([:totime $uptime] >= [:totime $timeout]) do={
:put ("USERNAME: $username - UPTIME: $uptime - TIMEOUT: $timeout")
:log info ("USERNAME: $username - UPTIME: $uptime - TIMEOUT: $timeout")
/ip/hotspot/active/remove $a
}
}
}
}
}
}