for time interval, simply use the scheduler to launch the control at a given time
/user enable [find where name="user1" and disabled=yes]
if you want log also when the user is enabled (and not everytime if is enabled or not)
:local user "user1"
/user
:if ([:len [find where name=$user and disabled=yes]] > 0) do={
enable [find where name=$user]
:log info "User $user enabled again"
}
if you want continuosly check, but activate on given time interval (
do not overlap with midnight!!!)
without logging
:local user "user1"
:local timefrom "14:00:00"
:local timeto "18:00:00"
:local now [/sys clock get time]
:if ( ([:totime $timefrom] < $now) and ($now < [:totime $timeto]) ) do={
/user enable [find where name=$user and disabled=yes]
}
with logging
:local user "user1"
:local timefrom "14:00:00"
:local timeto "18:00:00"
:local now [/sys clock get time]
:if ( ([:totime $timefrom] < $now) and ($now < [:totime $timeto]) ) do={
/user
:if ([:len [find where name=$user and disabled=yes]] > 0) do={
enable [find where name=$user]
:log info "User $user enabled again"
}
}