ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Reason" <>
Subject RE: ssh task - doesn't behave the same as command line ssh
Date Tue, 22 Apr 2003 01:19:51 GMT

Thanks - that works! 

Couple of Q's:

The shell on the remote machine couldn't find the executable for jar (in
other words "jar -xvf somefile" didn't work).  I had to add the full
path (/usr/java/bin/jar).  So this task doesn't exactly act the same way
as if you just logged into the machine.  Is there a way to make it see
the PATH that's assigned upon a normal login?

And lastly, why is there no way to make it fail on error?  The
documentation says the best it'll do is warn you (shouldn't that be
called warnonerrror?).  There doesn't seem to be a way to communicate an
exit status from the remote command to the local build process.  The
only way I can think of is to have the remote shell either echo "PASS"
or "FAIL" into an OutputProperty.  But then that'd be the only verbosity
you could get from the shell... Seems like a bit of a hack too.



-----Original Message-----
From: Dale Anson [] 
Sent: Monday, April 21, 2003 4:55 PM
To: Ant Users List
Subject: Re: ssh task - doesn't behave the same as command line ssh

I concur with Rob, use sshexec. It will be released with Ant 1.6 as an 
optional task. You can get it from Ant cvs, or you can download a ready 
to use jar from


Matt Reason wrote:

>I am using the ssh task to connect to a remote server and fire off a 
>shell script that deploys files from a big tarball into the htdoc dir 
>of that server.
>The code looks something like this:
> <taskdef name="ssh" classname="com.sshtools.ant.Ssh">
>    <classpath refid="project.class.path"/>
> </taskdef>
> <target name="ssh">
>     <ssh host="tecate" verifyhost="false" username="w3admin"
>        <exec cmd="./ > matt.log"/>
>     </ssh> 
> </target>
>      [ssh] Initializing J2SSH
>      [ssh] Creating connection to tecate:22
>      [ssh] Connecting....
>      [ssh] Authenticating w3admin
>      [ssh] Performing password authentication
>      [ssh] Authentication complete
>      [ssh] Executing ./ > matt.log
>When I run this target, the thing just hangs.  The shell doesn't 
>complete and the java process on my local machine goes crazy and takes 
>up 100% of the CPU.  I've also tried it without the output re-direct.
>If I was to login to the remote machine using ssh on the comand line 
>and then execute the shell, it works perfectly and takes about 2 
>Anybody know what I'm doing wrong?  Should I be using SSHExec?
>Thanks in advance,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message