Continuous Integration -- Starting and Stopping Windows services in your build

Version 2 by Marc Esher
on Apr 18, 2011 02:10.

compared with
Current by Marc Esher
on Apr 18, 2011 02:14.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (5)

View page history
{section}
h1. {column:width=60%}

{toc:maxLevel=5}





h1. Introduction
h1. How to use ANT to start and stop the MongoDB Windows Service
Fortunately, you can add ANT targets to start and stop these services which won't throw errors when start/stop fails, which is the behavior I need.
asdfaf
{code:language=xml|title=build.xml|controls=true|linenumbers=true}
<target name="startMongoService" depends="init">
<echo message="starting ${MongoDBService}"/>
<exec executable="cmd.exe">
<arg line="/c"/>
<arg line="net"/>
<arg line="start"/>
<arg line="${MongoDBService}"/>
</exec>
</target>

<target name="stopMongoService" depends="init">
<echo message="stopping ${MongoDBService}"/>
<exec executable="cmd.exe">
<arg line="/c"/>
<arg line="net"/>
<arg line="stop"/>
<arg line="${MongoDBService}"/>
</exec>
</target>
{code}

&nbsp;Then, in the Jenkins config, I simply specify *"startMongoService runtests stopMongoService"* as the ANT targets to run.
{column}
{column:width=5%}