views:

55

answers:

1

I want to execute a UNIX command from my local Windows XP system using ANT script. UNIX system is a remote server.

I have tried the following:

  <target name="execute" >
    <sshexec host="host IP" 
    username="uname" 
    password="pass" 
    commandResource="sh abc.sh"/>
  </target>

but got the error below:

 BUILD FAILED
 ..\build.xml:49: com.jcraft.jsch.JSchException:     connection is closed by foreign
 host
+3  A: 

take a look at the sshexec ant task. You will need a jsch library on the ant classpath and the UNIX server needs to be running a ssh daemon.

krock
@krock - I already have ant-jsch.jar, jsch-0.1.42.jar at my ANT_HOME/lib. But still got the "JSch Exception: connection is closed by the foreign host"
Shaun
Check the /var/log/messages file on the unix server to see what caused the connection to be shutdown.
Mark O'Connor
I have not found messages at /var/log directories. Checked other files at that location. Not found any SSH related error messages.
Shaun
from Windows command prompt where I am running ANT, have received "connection is closed by foreign host" error message.
Shaun