July 25, 20232 yr Hi, I currently only run Plex on my server, It is mapped to another server via SMB. How can I get the Plex container to wait to start until the SMB is mounted? I tried the wait option via advanced settings but it appears to control the wait period after that container has started. How do I put a wait period on the first and only container? Thank you.
July 25, 20232 yr Solution 3 hours ago, Smooth Beaver said: Hi, I currently only run Plex on my server, It is mapped to another server via SMB. How can I get the Plex container to wait to start until the SMB is mounted? I tried the wait option via advanced settings but it appears to control the wait period after that container has started. How do I put a wait period on the first and only container? Thank you. There isn't a built-in way to do this. I would personally use a user script to do this using the user scripts plugin. The script itself would be quite simple: #!/bin/bash #We'll use a helper functions to keep things easy to read. isMounted(){ findmnt "$1" > /dev/null } isRunning(){ docker inspect --format '{{json .State.Running}}' "$1" } #We don't want to try and start an already running container. #Plex isn't running, let's check if it's sane to start it. if ! isRunning "plex"; then #Until the path is mounted, we sleep until isMounted "/mnt/remotes/MySambaShareName"; do sleep 5; done #Path is mounted, time to wake up and start Plex: docker start plex fi You would set that script to run at array start, and you would turn off autostart for the plex container. You'll obviously want to change the name of the container and the mount path to fit your environment. Edited July 25, 20232 yr by Xaero
July 25, 20232 yr No worries - do be sure to let me know if that worked. I don't have that type of environment so I was not able to test that script properly. Syntax and logic seem right, but you never know
August 6, 20232 yr On 7/25/2023 at 2:27 PM, Smooth Beaver said: @Xaero Thank you!!! I'm silly, and forget things sometimes, but you could also use the script feature of the unassigned devices plugin to handle the starting of the plex container - it has a section where you can define a script to run when a path is mounted, you could use this to start plex when the path is mounted. Both ways work, and each has their advantages and disadvantages.
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.