betto95 Posted August 5, 2023 Share Posted August 5, 2023 I have a static ip with my primary connection, I also have a backup connection that relies on lte and it's not unlimited. So I'm trying to figure out a way to stop some dockers when the primary connection is down, I think the easiest way is to write a script that checks the ip, so when it changes from the static one it shut down some dockers and when it's back up it restart those. I don't really know how to accomplish that I'd really appreciate any help, thanks Quote Link to comment
Solution JonathanM Posted August 6, 2023 Solution Share Posted August 6, 2023 Here is a link to a post with some of the parts you need. I use it to start a VM after my gateway IP is pingable. https://forums.unraid.net/topic/78454-boot-orderpriority-for-vms-and-dockers/?do=findComment&comment=727416 You could reuse some of the code to stop and start containers with the docker pause and unpause or stop and start. It would need a major rewrite to accomplish exactly what you want cleanly, but I think all the parts are there. Quote Link to comment
betto95 Posted August 6, 2023 Author Share Posted August 6, 2023 Than you! I made 2 scripts, one that starts with array and stay in loop until my static ip can't be reached, so it stops some dockers, restart a vm and start the second script, that stays up until my static ip is up than it make the same thing but in reverse. Seems to work just fine 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.