Reputation: 902
I'm using a parrallel task to test and shutdown my server.
Here is the code :
<target name="runandtest" description="run the server and test it">
<parallel timeout="1380000">
<sshexec host="XXX.XX.XX.XX" username="XXXXX" password="xxxxxxxxx" trust="true" command='cd test;nohup bin/server > log.txt'/>
<sequential>
<sleep seconds="1200"/>
<!-- run test-->
<scp file="XXXXXX:[email protected]:/home/XXXXX/test/log.txt" todir="/ant/" trust="true" />
<mail enableStartTLS="true" mailhost="smtp.gmail.com" mailport="587" user="XXXXXXX" password="XXXXXXX" subject="Run test" from="XXXXXXXX" tolist="XXXXXXX" files="log.txt" message="blabla"/>
<!-- FAIL BELOW -->
<sshexec host="XXX.XX.XX.XX" username="XXXX" password="XXXXX" trust="true" command="kill $(ps aux | grep '[s]erver' | awk '{print $2}')"/>
</sequential>
</parallel>
</target>
The build fails where I've written the comment.
It's indeed pretty logical since once my test are done, I simply ssh on the same server & kill the process of the first parallel task.
But in my run-test-shutdown process it's a completely normal behaviour, so I was wondering if it was possible to sort of catch this BUILD FAIL error so my ant project could continue.
Thank you.
Upvotes: 1
Views: 457
Reputation: 78225
The Ant sshexec task has an attribute failonerror
which defaults to true - perhaps you can set this to false for your shutdown target.
Upvotes: 1