Jump to content

How to auto restart Emby service?


raptorjr

Recommended Posts

raptorjr

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?

 

 

 

Link to comment
Share on other sites

freebs

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
Link to comment
Share on other sites

Deihmos

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.

Link to comment
Share on other sites

Lessaj

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.

Link to comment
Share on other sites

Lessaj

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
Link to comment
Share on other sites

Saner2oo2

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
Link to comment
Share on other sites

ressu

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

Link to comment
Share on other sites

raptorjr

Thank you all.

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

Link to comment
Share on other sites

JakeByr

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. 

Link to comment
Share on other sites

  • 2 years later...
macntouch

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.

Link to comment
Share on other sites

mastrmind11

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.

Link to comment
Share on other sites

macntouch

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.

Link to comment
Share on other sites

  • 8 months later...
tlmr_guest

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?

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