SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By jqpublick
#16701
I am trying to automate the starting of the OpenOCD damon within Eclipse and/or batch files, and I want to avoid opening multiple instances of the damon.

Is there an way to test this in a batch file?

Is there ever a reason to have multiple OpenOCD daemons running? If not, OpenOCD should test if an instance is running already and exit. Or, it would be nice to have a command line switch that will only start up the daemon if it isn't allready running. (or vice-versa)

- Joe
By Dominic
#16739
By design it's possible to run more than once instance of the OpenOCD, and I want to keep that possibility.

Is there something like a "killall <process name>" command on windows? That's what I'd use on linux.

Looking for a previous instance would be totally non-portable, therefor I'd prefer not to include this in the code.

Regards

Dominic
By Ray
#16788
jqpublick wrote:I am trying to automate the starting of the OpenOCD damon within Eclipse and/or batch files, and I want to avoid opening multiple instances of the damon.

Is there an way to test this in a batch file?
Is rather easy to do, I took some sample code from msdn and adjusted it a bit to suit your needs.

AppRunning.zip

You can use it like this in a batch file
Code: Select all
AppRunning.exe winamp.exe
if errorlevel 1 goto running
echo "Not running"
goto end
:running
echo "running"
:end
Since it's just a quick hack it's not as userfriendly as it could be, there is no validation on command line parameters and the processname you enter must match exactly as it shows up in the taskmonitor (case sensitive).

Source and vs.net 2005 project is included incase you want to fix those things your selve.