Jump to content

Keep Emby Server running


4fred

Recommended Posts

If you like me are running Emby Server on a Windows computer you know that it sometimes fails... if you like me sit in front of the TV with just a remote in your hand and want to watch your favorite show and Emby have failed, and in 99,9% of the time all you need to do is start it again you get somewhat annoyed. You can probably handle this a thousand ways but I wrote a small powershell script that checks if the website is responding, if it isn't stops the emby processes and starts them up again.

I run this as a scheduled task and it have kept my Emby more up and running than before.

 

I have tested this on a Windows 10 computer, I have no idea if this runs at all on any other version of Windows. I would guess that it does but you probably have to update Windows Powershell to use it.

 

How to use it.

Create a .ps1 textfile (Like C:\MyScripts\Emby-Monitor.ps1) with this content:

$embywebsite = "http://localhost:8096"

try{
   $x=Invoke-RestMethod -Method Get -Uri $embywebsite -ea stop -TimeoutSec 5
}
catch{
   Write-EventLog -EntryType Error -LogName Application -Source “Emby-Monitor” -EventId 8096 -Message "Emby Website is DOWN - Shutdown and Startup again"
   Stop-Process -Name *Emby* -Force
   Start-Process $env:APPDATA\Emby-Server\system\EmbyServer.exe
}

You need to run the below command as an administrator once, this is to create the source for eventlog
If you do not do this monitoring will still work but it wont write anything in the eventlog

New-EventLog –LogName Application –Source “Emby-Monitor”

Create a scheduled task that runs the scipt how ever often you like as the logged on user

To test it simply exit Emby (taskbar icon, right click and exit) and run the scheduled task and Emby should start up again.

 

 

Link to comment
Share on other sites

If you like me are running Emby Server on a Windows computer you know that it sometimes fails... 

 

Actually, no, we don't know this :).  My server has been running for over a year without failing.

 

So, please do follow CBers advice and provide us some details so we can get to the bottom of your issue.

 

Thanks.

Link to comment
Share on other sites

I did not intend this post as app bashing! I like Emby alot and have been running it for years! :)

 

I created the above script after I had updated to Windows 10 a while back, I more than likely ran an alfa/beta of Emby back then just to get on the 10 platform - thus I'm likely for some of the crashes myself.

I have some other stuff that I use similar solutions to keep them running. I had even forgotten that I use it for Emby. But the last update reminded me as I was checking logs of my PC running Emby. Last update did some crap trying to update, shutdown and not restarting again. Apparently a few times... so I did the update manually and now everything is fine again.

This have happened to me before thus I created the script a while back.

I posted this only to share with you guys and your users to keep it running IF it craps out.

  • Like 1
Link to comment
Share on other sites

So are you saying that your Emby server no longer stops unexpectedly?

Naaah now running fine like most of the time. It have crashed maybe a handful times in the last year and most of those if Emby needs an update OR after reboot of the whole computer.

  • Like 1
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...