Execute ssh command on a remote server

1

I'm working on an Ant to pass files to a remote server and that works well for me, but at the time of running a .bat on the remote server to organize all the files that happened, I do not know what the problem is so that, instead of running exec on the remote server, do it in local.

The code I have is the following:

<sshsession
    host="xxxxxxxxxx" 
    port="22" 
    trust="true"
    username="Administrator" 
    password="xxxxxxxx">

    <sequential>

        <exec executable="C:/tools_deploy/extractor.bat" spawn="true">
            <arg value="C:/tools_deploy/extractor.bat"/>
        </exec>

    </sequential>
</sshsession>

This I do through SSHSession and I do not know what the error may be.

    
asked by exferos 13.06.2017 в 09:46
source

1 answer

2

I've already managed to do what I wanted to do. Basically instead of using the sshsession e used the sshexec (since I only want to execute a command).

The resulting code is this:

<sshexec 
    host="xxx.xxx.xxx.xxx" 
    port="22" 
    **trust="true"**
    username="mi_usuario" 
    password="secreta" command="C:/tools_deploy/extractor.bat">
</sshexec>

Beware: if you do not put the trust it fails when you execute it.

Anyway, thank you for your time. Greetings.

    
answered by 13.06.2017 / 10:15
source