Jump to content

Managing services that reside in the processes stack after there host


Commander X800

Recommended Posts

In an effort to make things a little less bolted and more efficient, I have set a fair amount of services that belong to applications that do not start with windows to run in maul mode, so that they are not just take resources when they are not needed. The problem i am having is that after i close the respective host application(s) when i am done with it, the corresponding services do not close out as well. Instead they just linger in the processes pool. My goal is to find a way to tell a given service to terminate after its parent application closes without me manually having to terminating the process in the task manager.

Edit: to fix title.

Edited by Commander X800
Link to comment
Share on other sites


Not automatically.

The easy solution is to make a quick script that:

  1. starts the required service(s)
  2. starts the application (and waits in the background, hidden)
  3. when the app terminates, it stops the services again

A simple vbscript (or jscript or whatever) could easily do this for you in a few lines (about a dozen or so). Have a peek at the Win32_Service WMI class (specifically the StartService and StopService methods), and the Run method of the Wscript.Shell object.

Edited by CoffeeFiend
Link to comment
Share on other sites

Not automatically.

The easy solution is to make a quick script that:

  1. starts the required service(s)
  2. starts the application (and waits in the background, hidden)
  3. when the app terminates, it stops the services again

A simple vbscript (or jscript or whatever) could easily do this for you in a few lines (about a dozen or so). Have a peek at the Win32_Service WMI class (specifically the StartService and StopService methods), and the Run method of the Wscript.Shell object.

So i could make this in Visual Studio 2008 then?

Link to comment
Share on other sites

So i could make this in Visual Studio 2008 then?

Sure, you could do it in C# if you wanted, but that's quite overkill, and not so flexible: you'd have to recompile every time you make some small changes... Or you could avoid that at the expense of having to use a XML config file (i.e. app.config) which again seems a little over the top for something so simple. Plain old notepad is more than sufficient for this.

Edited by CoffeeFiend
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...