Jump to content

How to auto restart Emby service?


Recommended Posts

raptorjr
Posted

If I'm lucky, Emby server only crasch once a day, and I have only one time seen it running for 5-6 days. But it is annoying when I want to sit down and watch something just to realize that the server have crasched again.

 

I'm not that good on Linux/Ubuntu, but I wonder if there is some way to automatically restart a crasched Emby server process? I've heard of something called monit, but don't know how to use it. But maybe there is other things I could use to accomplish the same thing?

 

 

 

Posted (edited)

Open a terminal

 

type as follows:

sudo service emby-server restart

 

it will ask for root password

emby will restart - mine crashes as well, not sure why yet.

Edited by freebs
  • Like 1
Deihmos
Posted

I am just curious why you would use it if not good with it? I installed ubuntu to try it out yesterday and installed emby but couldn't imagine switching. I have had emby running over 30 days and I have never seen it crash. That's on Windows though.

Posted

My server (linux mint 17.1) has been up for 125 days, I haven't rebooted it since I built it. Not a single emby crash.

Posted (edited)

I'm freehanding this but you can try something like this:

 

 

(as root, or do some work with expect to type in your password for you, you'll have to add sudo infront of the server start if you do that)

nohup ~/mbhealthcheck.sh &

 

#!/bin/bash
while [ 1 ]
do
       CHECK=`ps -ef | grep -i mediabrowser.server | grep -v grep | wc -l`
 
        if [ $CHECK -eq 0 ]
        then
        service emby-server start
        fi
        sleep 300
done
Edited by Lessaj
Saner2oo2
Posted

from memory.

 

 

sudo apt-get install monit

sudo nano /etc/monit/monitrc

 

 

change (if you want its httpd)

set httpd port 2812

 

to remove the hash (#)

set httpd port 2812 and allow user:password.

 

 

 

add to the end, before the includes.

 

 

 

 

##############

check process emby-server with pidfile /var/run/emby-server.pid

start program = "/etc/init.d/emby-server start"

stop program = "/etc/init.d/emby-server stop"

if failed host localhost port 8096 then restart

###############

 

 

 

 

sudo service monit restart

 

 

http://localhost:2812

  • Like 1
Posted

You might also check out this post: http://emby.media/community/index.php?/topic/21954-emby-crashes-consistently-due-to-a-sigsev-as-well-as-a-long-loop-of-createprocess-error-creating-process-handle/&do=findComment&comment=215368

 

That should be the cause of the server shutdowns. It'll be fixed in Ubuntu eventually, but in case you want to fix the root cause instead of remedying the symptom, you could upgrade your kernel..

Saner2oo2
Posted

mine is on 4.1 (albeit rc6, i need to update) and its still very crashy

raptorjr
Posted

Thank you all.

Much help and many good suggestions. In one way or another this will help me alot.

Posted

I've been having trouble with the server crashing on me as well. Just posted some logs to hopefully get some light to shine on this. 

  • 2 years later...
macntouch
Posted

I'm using daemontools under linux. It will monitor emby-server service status, and if the service is unreachable, it will restart automatically. It's working like a charm.

Posted

Thanks for the feedback.

mastrmind11
Posted

FWIW, recent flavors of Linux have moved to systemd, which offers auto-restart of units natively.  I, and others here, have had great success w/ monit as well.  But since the OP is over 2 years old, and most of what I've said is already covered above, I digress.

macntouch
Posted

Auto-restart in systemd is not bullet-proof, i tried to tune the emby-server.service for auto-restart, but it always fails.

 

I had to use daemontools which monitor the service and restart when the service goes down.

 

My two cents.

  • 8 months later...
tlmr_guest
Posted

Auto-restart in systemd is not bullet-proof, i tried to tune the emby-server.service for auto-restart, but it always fails.

 

I had to use daemontools which monitor the service and restart when the service goes down.

 

My two cents.

Hi macntouch, can you guide me how can I add emby service in daemontools?

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...