You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Lybarger <Ma...@CBC-Companies.com> on 2004/01/08 14:09:57 UTC
fail on telnet task
i have a target which runs the ant telnet task to execute a remote shell script. right now, the only way i can figure out how to fail the ant task is if it hits a timeout waiting for the a read that doesn't get there. is there a way for the telnet task to capture the schell script exit status and act upon it?
below are the task(s) and shell script i'm using. if i run the status target with the timeout in the status.test target, the status target doesn't execute because the command times out. i realize the "Done" is never echoed.
_______________________________
<target name="status.test" description="run remote script">
<telnet userid="${jacobUserName}" password="${jacobPassword}" server="131.11.11.14" timeout="10">
<read>$</read>
<write>cd test</write>
<read>$</read>
<write>bash ./statustest.sh 1</write>
<read>Done</read>
</telnet>
</target>
<target name="status" depends="status.test" description="main testus target">
<echo>checked the status</echo>
</target>
_______________________________
#!/usr/bin/bash
#
# testing exit codes from remote ant.
echo "Starting the test status script" $1 > status.txt
exit $1
echo "Done"
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003