I wanted to automate a container start and container shell command in mirkotik scripting. I want to scan the hostname and status of the container. I wrote a code wich should work but it doesn t and I don t know why. i first tried just looking at the hostname but it doesn t work either. the if statement just doesn t run and i get no log output.
:local myName do={:put "hostname";:return};
:local myCon do={:put "container";:return};
:local userinput [$myName];
:local containerlist [$myCon];
:local var1 [/container find count-only where hostname=$userinput]];
:if ( $var1 = "0") do ={
/container start $containerlist;
/container shell $containerlist;
:log info "is running";
} else {
:log info "doesn't work";
}