Cannot create windows service with command line arguments on executeable

I’m trying to create a windows service and I have to provide command line arguments to the executeable itself.
I’m not talking about the arguments which can be provided with the startup of the service.

Here is an example of a standard windows service:
“C:\WINDOWS\System32\svchost.exe -k netsvcs”

The problem starts here:

The deployment script tries to resolve the path - which fails, if I add something like the additional parameters into the executeable path input field in the config.

Background: It’s a python based windows service, so I have to run something like “C:\python35\python.exe C:\long\path\to\script.py”

Is there a easy workaround for what I want to accomplish?

Thanks,
Philipp

Hi Philipp,

Thanks for reaching out! I’d love to help figure out why it’s not resolving the path. Would you be able to send a bit more information so we can investigate further?

Which Octopus version are you running?
Could you send any errors you’re hitting?
Could you also send me a full deployment log by following these steps?

  1. Add these 2 variables to your project
    http://docs.octopusdeploy.com/display/OD/Debug+problems+with+Octopus+variables

  2. Create a new release (so the new variables take effect) and deploy it. If possible skip as many steps as you can and only leave step we are troubleshooting in order to avoid the noise in the log.

  3. Send us the raw log of that deployment
    http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task

Kind regards,

Kenny

Hi Kenneth,

thanks for getting back so fast!

Before doing all this stuff, all you have to do is run the following powershell command:
Resolve-Path “C:\WINDOWS\System32\svchost.exe -k netsvcs”

You will see, that it is going to throw an error. Howerver what you can do is run the following:
Resolve-Path “C:\WINDOWS\System32\svchost.exe”

Without the extra arguments it’s going to execute just fine.

The problem is, that you are expecting the path to be only a path to an executeable, but in fact it may be a path with arguments added to it.

I cannot use the “Arguments” input field for this usecase in the windows service setup screen, because this will generate a command like:
“C:\WINDOWS\System32\svchost.exe” -k netsvcs

The difference is in the quotes.

Thanks and best regards,
Philipp

1 Like

Here is also a very good read about what I need: http://stackoverflow.com/a/11084834/648563

Hi Philipp,

Octopus deploy should be handling these arguments correctly which means there is something else wrong here. Grabbing the log files from you will give us a view of how it is currently set up and what is going wrong.

So the following info would greatly help us in identifying why your services are not handling the quotes correctly.
Current version of Octopus.
Error message you are receiving.
Logs following the steps outlined previously.

That should give us the information we need to help you get your services working as intended.

Looking forward to hearing from you and getting to the bottom of this. :slight_smile:

Regards,
Daniel