Fork process with CC .NET
Asked Answered
P

4

5

Is there any way to fork a process inside Cruise Control .NET? I want CC .NET to launch a program when everything's done but right now, CC .NET insists on waiting for the program to close before saying that the build is complete.

The program that is launched must run for up to weeks at a time.

Placative answered 1/12, 2009 at 2:21 Comment(0)
G
5

The way I would do it is to use a PowerShell or Batch script. The script can launch your process and return back normally to CC.NET after spawning the executable. This is the only way I can see doing it, as CC.NET does need to know it returned and the script can return, even with the process you spawned still out there running. A sample PowerShell script that will do what you want. Then you just call the powershell script with the path to the exe as a paratemeter.

    param(  [string] $exePath = $(throw "A path to executable required.")
    )

Invoke-Item $exePath

here on CC.NET 1.5 would be how to set up the powershell task

<powershell> 
    <script>yourScriptName.ps1</script> 
    <scriptsDirectory>D:\CruiseControl</scriptsDirectory> 
    <buildArgs>full path to exe you want to kick-off</buildArgs>     
</powershell>
Graminivorous answered 7/12, 2009 at 18:15 Comment(0)
T
2

How about this... 2 Small programs

1) A process that runs all the time (maybe a windows service?), and listens on a tcp socket, when it gets a connection, execute your 3 week process.

2) A process that can be called by CC.NET, and opens a tcp connection to process #1, and then exits.

You could use any form of inter-process communication, but TCP sockets are easy and reliable.

Theodor answered 7/12, 2009 at 18:45 Comment(0)
M
1

Put the launch of the program into a separate CCNET project and add a ForceBuildPublisher to the original project.

<project name="OriginalProject">
  <!-- ... -->
  <publishers>
    <!-- ... -->
    <forcebuild>
      <project>LaunchProgram</project>
   </forcebuild>
  </publishers>
</project>
Mistook answered 1/12, 2009 at 5:57 Comment(1)
Unfortunately, CC .NET times out and kills the process after a while.Placative
C
0

I haven't tried the solution with powershell(the selected answer), but I use ruby rake and whatever I tried to fork independent process group with ruby library, CruiseControl STILL INSIST on waiting for the asynchronous process to finish.

For me; The only way to fork independent daemon process /server application successfully with CCNET is using task scheduler (https://mcmap.net/q/139213/-create-a-new-cmd-exe-window-from-within-another-cmd-exe-prompt)

so use schtasks.exe to create a throwaway run once task to start your process

you can call schtasks and set the start time dynamically using batch file, ruby rake or powershell.

Copyhold answered 4/2, 2013 at 4:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.