Fork process with CC .NET - cruisecontrol.net

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.

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>

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.

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>

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://stackoverflow.com/a/14679992/423356)
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.

Related

Task Scheduler loads script into editor instead of running it

My AutoIt script that executes from Windows Task Scheduler under Windows 7 works fine. On my Windows 10 machine with the identical task, instead of running the script, the Task Scheduler loads it into SciTE (an editor that accompanies AutoIt).
When I execute the script from within Explorer it runs. When I execute it from a command line it runs. It's only from Task Scheduler that I get this misbehavior. How do you tell Task Scheduler I want to run the script, not edit it?
If you do not wish to compile it, you can pass the script name to the AutoIt executable. For example:
"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Scripts\Test.au3"
This is how it would look in Task Scheduler:
And you can read more about AutoIt command line switches at this
online help page.

Mule Esb run in background from linux command

i can't figure out how to start a mule esb from command terminal in linux without keep calling the wrapper, which obliges me to mantain active the terminal.
I can actually use this simple command (from bin directory):
./mule
Anyways, if i need to pass a parameter, like this:
./mule -Denv=prod
it keeps starting in foreground mode.
How can I achieve a background start with parameters?
thanks!
Just tried it: ./mule start works in background with params (if needed). You can then stop it running ./mule stop. HTH.
Mule will be handled by the script which is placed at MULE_HOME/bin/mule. This script supports start|stop|restart|status|dump|console.
For production mode Mule should be configured as deamon as well - systemctl or service.

Powershell script not running on Task Scheduler

I have a PS script that opens Excel (Com Object), processes a bunch of information, re-saves, and then sends some critical information via e-mail. The script runs great, and when I run it from the Run Console, it works great as well. However, when I schedule it as a task in the Task Scheduler it is not working properly. The task seems to "successfully run" every single time, but I do not get the output e-mail that I am supposed to get. I have run many other PS Scripts without a problem using the same configuration in the task scheduler. Could this have something to do with opening Excel as part of a script scheduled? Any thoughts are welcome.
I solved this issue using the answer from #briantist in PowerShell script won't execute as a Windows scheduled task, but I wanted to isolate exactly which switch was solving the problem.
It had nothing to do with -ExecutionPolicy, -Noninteractive, -NoLogo, -NoProfile or any other system privilege, user account running the script, etc.
Just needed to add -File in front of the script path in the Task Scheduler > Actions > Arguments field. Without this switch PowerShell was launching and the task history was showing Action Completed, but the script was not executing.

How to find my JavaFX application in process manager?

I have a JavaFX application that should check if it has already been launched when you launch it (need only single instance running at the time). The problem is how to define it!
I have tried packing my JavaFX application into .exe file (or make an .exe launcher) that will be shown as the "MyProg.exe" process in the Windows task manager, not the "javaw.exe". But it is not the solution (I've tried netbeans' tools) because it adds jre to my application thus enlarging it from 1 mb. to 130+ mb. (can you help me with it?)
I've tried launch4j, but both launcher and .exe package starts javaw.exe to run my app. And when I check process manager and see 2 javaw.exe I don't know, is it 2 instances of my app or just another app running?
I hope I described it clearand will be very thankful if somebody can help me with it!
Judging by your approach it seems that you are already found a way to get a list of Windows' processes from Java. In this case you can use one of the next solutions:
Take other process info into account. E.g. command line or window title. Windows command line can be retrieved using wmic.exe PROCESS command and for Unix-bases systems by ps -Af.
When your program starts store it's process id in the registry or file in homedir. When another instance starts it should check that value and if process with that id alive then just exit.

How does one start a process from CruiseControl .NET that persists after CC .NET exits?

I have a program that normally runs constantly. Whenever there is a new checkin to Subversion, CC .NET kills the program and makes a new build. I want to start a new instance of the program from CC .NET.
Right now, if I use <executable>, then CC .NET hangs while it waits for the process to end, which will never come by definition.
As far as I know there is no way to get CC.NET to launch something without it getting a return value and not have an exception. So to get around this my first thought would be to use the executable task to call some form of script, which can then launch the exe and return back to CruiseControl.

Resources