Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wait First Container Start

Featured Replies

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.

Solved by Xaero

  • 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 by Xaero

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 ;-)

  • 2 weeks later...
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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.