When deploying a Windows service, you have the option of setting the Start mode to Unchanged. This is extremely useful for us, since some of our servers may be a cold standby, where the service is installed, but disabled, and active on other servers.
When we use this, though, if the previous installation was Automatic (and running), after deploy, the service is stopped.
Octopus should start the service automatically, if the Start mode is Automatic or if the Start mode is Unchanged and the previous mode before deploy was Automatic.
I’m having this same problem, running Octopus 184.108.40.2061. The service is initially running and its startup type is Automatic. In the deployment step, the start mode is set to “Unchanged”. I see these messages in the log:
The QWParallelService service already exists; it will be stopped
Stopping the QWParallelService service
Service QWParallelService stopped
Then a bunch of other stuff about the release - configs and whatnot, then:
The QWParallelService service already exists, it will be reconfigured.
sc.exe config "QWParallelService" binPath= "\"C:\Program Files (x86)\qw\QWParallelService\QWParallelService.exe\"" DisplayName= "QWParallelService" depend= "/" obj= "LocalSystem"
[SC] ChangeServiceConfig SUCCESS
Updating the service description
[SC] ChangeServiceConfig2 SUCCESS
The QWParallelService service start mode is set to unchanged, so it won't be started. You will need to start the service manually.
I get these same messages in the log regardless of the service being in a running or a stopped state prior to deployment.
Is this a bug or a feature that I just don’t understand? The intention is to have the service running after the deployment if it was running before, and to have it stay stopped if it was stopped before. The latter condition is met at least, but not the former.
Thanks for reaching out. The “Startup type” sets how will the service behave when the OS boots. If you want the Service to be at the same state (started or stopped) as it was before the deployment, you’re gonna have to capture its status at the beggining of the deployment in a variable, and then use that variable on a conditional loop to whether start it or not at the end.