Hi,
thanks for your reply. Based on your suggestions, I created a script to start adguard, but it does not solve the problem. (This is my very first ROS script I wrote so I'm happy to get feedback.)
:local containers [/container find where tag~"adguard"]
:foreach adguard in $containers do={
:local rootDir [/container get $adguard root-dir]
:log error ("root-dir: " . $rootDir)
:local rootDisk [:pick $rootDir 0 [:find $rootDir "/"]]
:log error ("root-disk: " . $rootDisk)
:local mounted false
:local triesLeft 15
:while ((false = $mounted) && (0 < $triesLeft)) do={
:if (0 < [:len [/file find where name=$rootDisk]]) do={
:delay 5s
:set mounted true
} else={
:set triesLeft ($triesLeft - 1)
:log error ("adguard root disk not mounted, wait for 2 seconds")
:delay 2s
}
}
:if (true = $mounted) do={
:log error "root disk found for adguard"
/container start $adguard
} else={
:log error "failed to find root disk for adguard"
}
:if ("running" = [/container get $adguard status]) do={
:log info "adguard container started successfully"
} else={
:log error ("failed to start adguard container" . $error)
# TODO: set alternative DNS server
}
}
:log error "script run"
It can be seen in the logs that the root disk is not set up properly for the first check but after that, it gets mounted. The container start command is executed but adguard remains stopped:
(I have already tried to add a 5 seconds delay between container start and status check, but that didn't help either.)
07:53:35 script,error root-dir: usb2/docker/adguard-home
07:53:35 script,error root-disk: usb2
07:53:35 script,error adguard root disk not mounted, wait for 2 seconds
07:53:42 script,error root disk found for adguard
07:53:42 script,error failed to start adguard container
07:53:42 script,error script run
Do you have any ideas what to synchronize the start of the container to in order to make it work?