Isn't there a "failsonerror" parameter to make the build fail if the
ssh command called fails? Would that do what you want?
Unlike "exec" task, the sshexec task doesn't have a "resultsproperty"
that can contain the exit code if the task fails. So, you can't check
for that.
You can set outputproperty, and then use the "matches" condition to
parse the output to see if your sshexec's output is what you expected:
<ssh host="${a_hostname}"
username="${a_username}"
password="${a_password}"
command=" test -d ${a_dir} ||
mkdir -m 777 ${a_dir} 2>&1;
cd ${a_dir} 2>&1;"
trust="true
outproperty="ssh.output"/>
<condition property="${dir.not.created.flag}">
<matches pattern="[a-z]" string="${ssh.output}"/> <!-- If mkdir
worked, no output is produced -->
</condition>
<fail if="${dir.not.created.flag}"/>
Not 100% sure if this will work or not.
On Jan 15, 2008 2:29 AM, Z W <[EMAIL PROTECTED]> wrote:
> Hi
>
> Can folks here give examples on how to perform a condition check for this ?
> I'm executing a sshexec and how do I use <condition> to work like
> if-then-else, following <sshexec> to check if this is executed succesfully
>
> <sshexec host="${a_hostname}"
>
> username="${a_username}"
>
> password="${a_password}"
>
> command=" test -d ${a_dir} ||
>
> mkdir -m 777 ${a_dir};
>
> cd ${a_dir};"
> trust="true"/>
>
> <condition ?????? (how do I check) >
>
>
>
>
> Thanks in advance
>
--
--
David Weintraub
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]