Jump to content

Question about restarting Windows Service


Recommended Posts

Posted

It should be a trivial task - set the service to restart itself upon a failure and exit the process.

Posted

Not reliably no.  This is why automatic updates don't work when running as a service.

 

We know how to solve this but it isn't a trivial task and would need a dev to step up and contribute to do it.

Posted

It should be a trivial task - set the service to restart itself upon a failure and exit the process.

 

Yea you can falsely report an error and trick windows into restarting the service. We're not doing that. We like to follow best practices here. Plus, who would be the one to answer all the questions about why the windows event viewer is filling up with Media Browser errors.

Posted

When I have MediaBrowser setup as a service, I only have the option to shutdown. I am sure that is by design, but why? Can a service not restart itself?

Posted

I can understand that, but I don't consider any of the other options a "best practice" either.  The system is the only one guaranteed to be able to restart the service, otherwise you're leaning on the permissions of the account the service is running under to be able to do it.  I suppose if it's already a system account it would be OK.

Chris Jones
Posted

I was part way through implementing restarting the service from the web ui by running another process that starts the service back up. On my system as long as the service has admin rights (such as local system) then it worked fine. However i didn't get round to trying it with different UAC levels or user accounts.

 

I also needed to get the new restarter exe to be part of the installer which i got stuck on and ran low on time. I will try to get back to this soon if i get some time.

  • 2 weeks later...
Posted

Question about this... How can I update the service? It says to download the installer and manually restart the service. I did that, but all it does is update the regular server rather than the service. Am I missing something?

Posted

They are the same program.  There is only one update.

Posted

They are the same program.  There is only one update.

Okay, I found the problem... I installed it as the local user I created when installing the virtual machine. I tried updating it as my domain user. Kindly weird how it installed in the AppData folder of a user.. But I will work on migrating it over now. Thanks for your help.

Posted

Both users must have been admins....?

Posted

Correct... My local admin account then my domain admin account.

Posted

Okay.  We install the server into the first Admin user account we can find.  99% of people only have one.

 

We go into the user area so that we can do automatic updates without any access control issues.

  • 1 month later...
Posted

Wouldn't putting it into the \ProgramData folder accomplish the same thing without potentially putting it into the wrong user's folder?

Posted

Wouldn't putting it into the \ProgramData folder accomplish the same thing without potentially putting it into the wrong user's folder?

 

No because we cannot guarantee write access to ProgramData from our program when it is running.

Posted

I was thinking from the service side of things.  If the service is running under the local system account then permissions to write wouldn't be a problem.  If it's running as a normal user I can see where it might cause some problems.

Posted

We have to support running as a normal app too (which is how the vast majority of people do run the server).

Posted

I think the only reason the majority of people run it as a normal app is because of the lack of support for automatic updates and restarting of the service.  I for one would be much happier if I didn't have to resort to my MBS using autologon to gain these two features.

Posted

Why not install it as a service by default? I'm not arguing, I am just curious what the disadvantage is. There are many programs that install as a service by default.

Posted

Why not install it as a service by default? I'm not arguing, I am just curious what the disadvantage is. There are many programs that install as a service by default.

 

See the post above yours.

Posted

I think the only reason the majority of people run it as a normal app is because of the lack of support for automatic updates and restarting of the service.  I for one would be much happier if I didn't have to resort to my MBS using autologon to gain these two features.

 

I'm sure there is a bit of a chicken and egg thing here but there is also no support for accessing anything via the tray menu when run as a service.  Eventually, we will probably be able to rectify both of those and then probably a lot more people will run as a service.

 

However, to run as a service also requires proper configuration of the account settings and introduces potential problems with the timing of start up.  So, for the common user, it is much simpler to run as a normal app.

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