Grokbase Groups Ant user July 2005
FAQ
I have an ssh task which executes a remote start command and I am trying
to get the exit status using outputproperty. However I notice that the
outputproperty value is not being set. Any Idea's? here is a part of my
build.

<sshexec host="${remote.server}" username="${remote.user}"
keyfile="${user.home}/.ssh/id_dsa" trust="true" command="xxxx"
outputproperty="step4.out"/>
<echo message="${step4.out}"/>
</target>

<target name="stop.step5" depends="stop.step4">
<if>
<equals arg1="${step4.out}" arg2="0" />
<then>
<XXXXXX>

---
${step4.out} is not being set at all. The ssh task executes fine.

Anil

Search Discussions

  • Anderson, Rob (Global Trade) at Jul 28, 2005 at 12:35 am
    Hi Anil, The sshexec task should fail if the exit status of your remote command is not zero. Here is the output from a simple sshexec task where I try to cd to a directory that does not exist:

    $ ant sshtest
    Buildfile: build.xml

    sshtest:
    [sshexec] Connecting to localhost:22
    [sshexec] bash: line 1: cd: /poop/poop/poop: No such file or directory

    BUILD FAILED
    H:\build.xml:56: Remote command failed with exit status 1

    Total time: 12 seconds

    The outputproperty will capture the ouput from the remote command, not the exit status. If you are running a script remotely, just make the script exit with the appropriate exit status and your sshexec command will fail if it is not zero.

    I hope this helps. Tell Barbara and everyone I say Hi.

    -Rob Anderson
    -----Original Message-----
    From: Jacob, Anil - MWL
    Sent: Tuesday, July 26, 2005 2:35 PM
    To: user@ant.apache.org
    Subject: Outputproperty in sshexec



    I have an ssh task which executes a remote start command and
    I am trying
    to get the exit status using outputproperty. However I notice that the
    outputproperty value is not being set. Any Idea's? here is a
    part of my
    build.

    <sshexec host="${remote.server}" username="${remote.user}"
    keyfile="${user.home}/.ssh/id_dsa" trust="true" command="xxxx"
    outputproperty="step4.out"/>
    <echo message="${step4.out}"/>
    </target>

    <target name="stop.step5" depends="stop.step4">
    <if>
    <equals arg1="${step4.out}" arg2="0" />
    <then>
    <XXXXXX>

    ---
    ${step4.out} is not being set at all. The ssh task executes fine.

    Anil

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org
  • Jacob, Anil - MWL at Jul 28, 2005 at 7:21 pm
    I have an ssh task which executes a remote start command and I am
    trying to get the exit status using outputproperty. However I notice
    that the outputproperty value is not being set. Any Idea's? here is a
    part of my build.

    <sshexec host="${remote.server}" username="${remote.user}"
    keyfile="${user.home}/.ssh/id_dsa" trust="true" command="xxxx"
    outputproperty="step4.out"/>
    <echo message="${step4.out}"/>
    </target>

    <target name="stop.step5" depends="stop.step4">
    <if>
    <equals arg1="${step4.out}" arg2="0" />
    <then>
    <XXXXXX>

    ---
    ${step4.out} is not being set at all. The ssh task executes fine.

    Anil

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesant
postedJul 27, '05 at 12:02a
activeJul 28, '05 at 7:21p
posts3
users2
websiteant.apache.org

People

Translate

site design / logo © 2022 Grokbase