Starting a Windows scheduled task


(David Zeidman) #1

I am using the community submitted Windows Scheduled Task - Create to start a Windows scheduled task. It creates the task fine but it does not substitute the action path correctly. I am trying to get it to start a previously installed application so I use the variable #{Octopus.Action[Billing Data Transfer].Output.Package.FilePath}

However when my task is deploy it does not convert the variable to the file name and path.

Any thoughts?

Thanks

David


(ben.dixon) #2

Are you running the “Billing Data Transfer” step as part of the deployment? Any referenced steps need to be run together in order for the variable to be populated.


(Daniel Fischer) #4

Hi David,

Thanks for getting in touch! As @ben_dixon said, the variable is referencing a step named Billing Data Transfer, if this step does not exist before the variable is being evaluated, or has a different name, then this would be causing this problem.

If you do believe this step exists and is being executed prior to the step where this variable is not evaluating, you will need to attach your logs for us to investigate deeper.

We have a documentation page on downloading the raw log file from your deployment. If you are happy to upload it here publicly, you can do so. Otherwise you are welcome to email it directly to us at support(at)octopus(dot)com.

Looking forward to hearing from you.

Best regards,
Daniel


(Daniel Fischer) #5

HI David,

Thanks for emailing in the log file. I have noticed however, that the variable you are referencing is not correct and most likely the cause of this issue.

You are calling:
#{Octopus.Action[Billing Data Transfer].Output.Package.FilePath}

This variable does not seem to exist in Octopus. If you are trying to reference the url where Octopus extracted your package, you will need to use the following variable:

#{Octopus.Action[Billing Data Transfer].Output.Package.InstallationDirectoryPath}
Or if using a custom installation directory:
#{Octopus.Action[Billing Data Transfer].Package.CustomInstallationDirectory}

I will also note that this will only output the directory where Octopus has extracted the package. If you need to reference a specific file, you will need to append it onto the end of this variable.

#{Octopus.Action[Billing Data Transfer].Output.Package.InstallationDirectoryPath}\program.exe

We have a section in our documentation on System Variables available to you in Octopus.

Would you be able to try this and let me know if it helps resolve your issue?

Looking forward to hearing from you.

Best regards,
Daniel


(David Zeidman) #6

Thanks for your response. I will certainly try what you have suggested. However you should know that FilePath is an option:


(Daniel Fischer) #7

Hi David,

Thanks for the update here! You are right! I didn’t see it when looking into this. However, this variable seems to be specifically related to the Transfer a Package step.

I checked our documentation and noticed found a reference to it here.

It looks like values for these variables are only created when the Transfer a Package step is run. It does seem a little bit confusing that we would show them if there is no Transfer a Package step in your deployment process.

I may need to run this past the team and see if this is something we can make a bit less confusing in the future. :slight_smile:

Let me know if you have any further questions here.

Best regards,
Daniel