Jump to content

Safely restart Emby from command line


SteveFintel

Recommended Posts

SteveFintel

I have Emby running in a TrueNAS 13.1 jail. I need to periodically reboot emby-server for it to pick up an updated SSL certificate. I have been using the command line:

service emby-server restart

but I'm afraid that doesn't safely shut down and restart the process. Is there a safer way to accomplish this?

Link to comment
Share on other sites

Hi, we don’t have a way from the command line at this time. I would suggest using the button in the web interface to shutdown. If you want to be able to script it then I would suggest using the Emby server api. Please let us know if this helps. Thanks.

Link to comment
Share on other sites

SteveFintel

It does, a little. That leads to more programming that I think I can do - I first have to authenticate a user and then send the command. Is what I'm doing now (service emby-server restart) dangerous?

Link to comment
Share on other sites

I’d probably suggest regular backups of the server data folder so that if you do run into a corrupted database you can easily restore from that.

Link to comment
Share on other sites

SteveFintel

I've already been doing the daily full backups. But perhaps I'm doing this wrong. Here's what I mean: the certificate that I use to authenticate Emby over https is a Let's Encrypt certificate that is updated randomly. Every night, I run a script that builds a new .pfx file and deposit that file in /var/db/emby-server/config. The only way I know to force emby-server to 'ingest' that certificate is by rebooting it. Is there another method that would be safer?

Link to comment
Share on other sites

Currently the pfx is loaded on server startup, so yes that means you have to restart. We should look at adding another way to refresh it though.

Link to comment
Share on other sites

  • 1 month later...
FrogMaster

Personally, I regularly use the following:

service emby-server stop 

Then I tend to do updates, ETC, and I will restart the service with

service emby-server start

I've never encountered any form of database, or data corruption while performing these actions and I've managed my server like this for years. I am doubtful you would encounter any issues by using what you've mentioned:

service emby-server restart

 

Edited by FrogMaster
Link to comment
Share on other sites

SteveFintel

Thanks for this. I was doing the same thing for a while but was worried because using the shutdown link within the UI is not nearly as quick as using the command line 'service stop...' I was always wondering if it was safely shutting down processes before actually stopping. So I feel better running: 

curl -X POST http://[emby_IP_address]:8096/emby/System/Restart\?api_key=[API Key]

I believe that runs the same command that gets triggered by the UI and it just feels 'safer' to me.

  • Like 1
Link to comment
Share on other sites

starfury

The command I run is this:

iocage exec emby /usr/local/bin/curl -X POST "http://[emby_server_ip]:8096/emby/System/Restart?api_key=[API_key]" -d ""
  

The "iocage exec emby" part is because I run a script in TrueNAS to update the SSL certs on several jails plus the system itself, so that commands TrueNAS to run the command inside the jail.

It's worked for 1+ years without a hitch.   Hope this helps.

  • Like 1
  • Agree 1
Link to comment
Share on other sites

SteveFintel

Updating the cert in a TrueNas jail is exactly the reason I'm rebooting Emby server. It's good to know we landed on the same solution.

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