Jump to content

Shutdown Command


JonnyLH

Recommended Posts

I'd like to set-up a cron which restarts the Media Browser every day or so. I downloaded the server restart plugin but then quickly realised it was for Windows as it made mono hog 100% of CPU when it tried to restart.

 

I'd like to refrain from killing the service, as I could leave sockets open etc. As there's a button on the server page to shutdown, is there a URL which could be called which would shut it down as the button would? I tried to look through the code but since it was JQuery heavy it wasn't too clear.

Link to comment
Share on other sites

Got a bit further with this, I see that it calls '/mediabrowser/System/Shutdown' but when I call that I get:

Handler for Request not found:


Request.HttpMethod: GET
Request.PathInfo: /System/Shutdown
Request.QueryString: System.Collections.Specialized.NameValueCollection
Request.RawUrl: /mediabrowser/System/Shutdown 

Since it specifies POST in the code I tried the following command:

curl -i -X POST http://********/mediabrowser/System/Shutdown 

Then it returns:

<h1>Length Required</h1>
Link to comment
Share on other sites

Is there a specific reason you want/need to restart the server (other then updates)?

 

I'd suggest creating an init script and restarting that one instead but that essentially "kills" the process.

Here's an OpenRC based example from the upcoming gentoo releases (which doesn't seem to leave open sockets etc.):

 

https://rhodecode.megacoffee.net/gentoo-overlay/main/files/ae7769fd75f1273f529aa62759a85bff3016b2bc/media-tv/mediabrowser-server/files/initd_1

 

There should be similar ways to do it using other init systems

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