ServicePilot 1.2

Published by

ServicePilot is a command-line utility designed as an alternative to NET and SC which allows you to reliably start/stop/restart Windows Services from your batch files and scripts.
ServicePilot is a command-line utility designed as an alternative to NET and SC which allows you to reliably start/stop/restart Windows Services from your batch files and scripts.

There are a few reasons that this utility is a good alternative to NET and SC like NET will wait at most 30 seconds for your service to start or stop. This can be a problem for services that take a while to transition - the inability for NET to patiently wait can lead to unexpected errors in batch files. Unlike NET START, SC START simply issues the command to start a service and promptly ends. SC does not attempt to wait for the service to transition to the Running state. Because of this, a script using SC to restart a service must contain extra complexity. After SC START, the script must loop, periodically checking for the status of the service and breaking out of the loop when the service moves to the Running state.

ServicePilot will fully restart a service, without any unneeded fuss.

Stopping a "slow" (or busy) service
-If your service takes a long time to stop (or gets stuck stopping), you should set a long enough "wait time" when using ServicePilot.

For example, we know that our "Device Automation" service can take up to two minutes to shut down. We use this command to stop it:

ServicePilot.exe -stop -wait 120 "Device Automation"
-Running with the verbose parameter shows how long it takes to stop the service: This has been an improvement over NET STOP, which would routinely throw up its hands after a timeout!

Starting a service with parameters
-Some services accept parameters when started. Those parameters can be specified in the Service Control panel application: Service Pilot allows you to provide parameters from the command line. This command starts our "RetailConnection" service with the port number it should use (8080), in debug mode:

ServicePilot.exe -start -args "/port 8080 /debug" RetailConnection

Command-line use:

ServicePilot.exe [-wait ] [-noforce] [-computer ] [-args ] [-verbose]

where:

-start: Start the service.
-stop: Stop the service.
-restart: Restart the service.
-wait : Wait for at least seconds before giving up or taking action. When stopping a service and it does not transition to the Stopped state in seconds, the service's process will be forcibly terminated (unless the-noforce option has been specified). When starting and the service does not transition to the Running state in seconds, the operation will fail. If not provided, the default value is 120 seconds.
-noforce: When stopping the service, do not try to forcibly terminate the service's process if all else fails.
-computer : Instead of working with the local computer, work with the service on the computer with name (or IP address) .
-args : Pass the given set of parameters when starting the service. Separate each parameter with a space. Be sure to quote the entire set of parameters!
-verbose : Produce verbose output.
: The name (or display name) of the service. Please be sure to enclose the name in quotes if it contains at least one space. Note: using the service name is more efficient.

 Download