although its a strange requirement 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";
}