Script to especific user

Hello,
I am trying to make a script that when a certain user logs in to RouterBoard it does reboot automatically.

I already tried my codes:

Example:

:log info message=("Start Check Login");
       :local i  value=[/user active find name=user];
       :local o value=user];
       :if ($i = $o) do={
       /system reboot
       }

But not working,

Best Regards
Leovon

although its a strange requirement :slight_smile: but any way, try below …

# Set variable with account name example ADMIN that is required for check
:local MYUSER "admin";
# Print Script ...
:log warning "Start Check Login for $MYUSER user ...";
# Get count number to see if MYUSER have open session
:local i [/user active print count-only where name=$MYUSER]
# Match formula , If user counts is 1 or above, 
:if ($i > 0) do={
# If yes then take action as required
:log error "$MYUSER FOUND ACTIVE, take action as required ...";
#/system reboot
} else={
:log warning "$MYUSER not found active";
}

Result:
script action.JPG