Jump to content

Windows - Check for drive then start emby server


pir8radio

Recommended Posts

pir8radio

I just figured I would share this, maybe it will help someone else, I actually forgot I wrote this batch file until I upgraded today to the .net core and it stopped working.   :)  I needed to update the emby path.

 

My windows box starts this batch file on startup, or you can run it manually.  What the batch file does is checks to make sure two drives are active before starting emby.  What it does is looks to see if (in my case) Drive F is mounted, if not it displays "SAN Down..." (F is my san) then waits 3 seconds and checks again... If drive F is mounted it skips over that section and looks for my Z drive and does the same check until it is also found, if both drives are found it finally starts emby.   You can chop this script up for one or more drives.   I needed this because my main media array is an iSCSI SAN, sometimes emby was starting before this drive was fully mounted giving me some issues in emby..  You could also use this to make sure a usb drive or something is plugged in before starting emby.   

 

Replace the emby path with your own path (last line) you can add the drive letters on lines 3 & 4  just replace my F and Z with whatever drives you want to check..  If you only want to watch one drive you can set MyDriveTwo to C.  Copy it to a text file, and change the text file extension from .txt to .bat

@[member="Echo"] off
:START
set MyDriveOne=F
set MyDriveTwo=Z
IF EXIST %MyDriveOne%:\NUL goto DRIVETWO

echo SAN Down...
PING 1.1.1.1 -n 1 -w 3000 >NUL
goto :START

:DRIVETWO
IF EXIST %MyDriveTwo%:\NUL goto DRIVESFOUND

echo Flash Drive Down...
PING 1.1.1.1 -n 1 -w 3000 >NUL
goto :DRIVETWO

:DRIVESFOUND
start C:\Users\MYwindowsUSERNAME\AppData\Roaming\Emby-Server\System\EmbyServer.exe

Edited by pir8radio
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...