Cannot Deploy Manual Start Windows Service

Hello,

I am struggling to get a service installed with Manual startup. No matter what value I use in startup type… Manual, manual, or demand, it always installs it using sc.exe start= auto.

I have read Windows Services - Octopus Deploy but our Octo server doesn’t seem to obey the documentation.

I am using the custom path - we have various utilities and shortcuts in windows that rely on the service being installed in a standard location.

Hi @jesse.wolfe,

Thanks for getting in touch!

I’ve tested this in our latest version and it does seem to work as expected.
As you were having issues with the Step Template settings not being retained correctly in your other topic, is this issue likely related to that too?

Regards,
Paul

Well, possibly!

However I thought I was fairly thorough -

  1. Deleted Existing service
  2. Created Fresh step from Step Template
  3. Didn’t change the Start Type value; default on Step Template was Manual
  4. Reran the RunBook

It installed the service but start= was ‘auto’

Can you confirm if this works on 2020.5.3?

PS. Why isn’t start type a drop-down with correct values? It’s not clear from the page whether you are using sc’s values or the Service Control Panel’s displayed values.

Hi @paul.calvert ~

I did a bit more experimenting. Looks like the custom path is throwing it all off. If I use custom path, “auto” is passed into the Octopus.Features.WindowsService_BeforePostDeploy.ps1. Once I got rid of custom install path, it used my ‘demand’ StartMode setting and did the right thing.

Is this defect fixed in 2020.6? I tried looking through the source to find out where Octopus.Features.WindowsService_BeforePostDeploy.ps1 was called from, but couldn’t locate it very easily.

I would like to keep the custom path, for a variety of reasons – mostly logging but we also have windows Libraries setup that jump to the service install dir. If it’s moving around that feature will no longer work. Also, splunk expects logs to be in a fixed location. I don’t really love the idea of a service log living away from the service itself, but may have to go there.

For now I can add a custom step to the script to force the type to demand (Manual) but the install is really slow this way because it stops and starts the service TWICE if the setting is auto.

Hi Jesse,

I’ve run some tests on this.

Initially, in 2020.4.2 I created a project with a basic Deploy a Windows Service step and step template based on that step. Both configured with custom installation locations and Manual start types.

When deploying, the first one created the service with a Manual start type, the step template switched it to Automatic.

After upgrading to 2020.5.8 and running the deploy again I saw the same results.

I then amended the step template and updated the usage in the project and created a brand new step template, configured the same, and added that to the project. After deploying both of these set the service to Manual.

So, it looks like there are two options here. Upgrading to 2020.5.8 and performing an amend and update on the step template should get it working again.
Or, you can avoid using the step template for now and add the Deploy a Windows Service directly to the project and this should also work correctly.