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.

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

Changes (5)

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


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.
<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}"/>

<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}"/>

&nbsp;Then, in the Jenkins config, I simply specify *"startMongoService runtests stopMongoService"* as the ANT targets to run.