Community discussions

MikroTik App
 
fritzme
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Thu Oct 31, 2019 6:10 pm

containers auto start on 7.6

Sat Oct 22, 2022 8:50 pm

Hello,

For anyone facing similar issue with starting of more then one container even if start-on-boot has been enabled.
I have updated my router running on 7.6 and only one container has been started after reboot.

Here is a workaround script
add dont-require-permissions=yes name=start_containers owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":local Nr [:len [:toarray [/container find  status=stopped]]]\r\
    \n:local i 0\r\
    \n\r\
    \n:while (\$i <\$Nr) do={\r\
    \n     :put \"Starting container with id: \$i\"; \r\
    \n      /container/start number=\$i;\r\
    \n     :set i (\$i +1);\r\
    \n}\r\
    \n"
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: containers auto start on 7.6

Sat Oct 22, 2022 9:16 pm

Do not post script as export, but from copy past from Winbox Syste->Scripts (unable to read)
Do not use ; at end of each line. Only needed to separate multiple command in same line.

So it would be some like this:
:local Nr [:len [:toarray [/container find  status=stopped]]]	
:local i 0
:while ($i<$Nr) do={
	:put "Starting container with id: $i"
	/container/start number=$i
	:set i ($i+1)
}

Who is online

Users browsing this forum: JDF and 18 guests