使用groovy激活带参数的远程ssh命令(use groovy to activate remote ssh command with parameters)

我正在尝试使用groovy脚本在远程服务器上激活命令。 我已经将我的ssh密钥复制到它运行的远程服务器上了。

ssh root@remote_server '/usr/local/bin/activate.pl'

当我尝试向远程脚本添加参数时,我遇到了失败:

ssh root@remote_server '/usr/local/bin/activate.pl android linux'

错误是: No such file or directory 。 因为我知道脚本在那里并且在添加参数之前它起作用我想问题是添加参数。

当我从shell激活远程shell时没有groovy远程脚本工作。 如何用groovy将它们传递给远程脚本? 谢谢

I am trying to activate a command on a remote server using a groovy script. I already copied my ssh key to the remote server it worked.

ssh root@remote_server '/usr/local/bin/activate.pl'

when I tried to add parameters to the remote script I got failures:

ssh root@remote_server '/usr/local/bin/activate.pl android linux'

The errros are: No such file or directory. Since I know the script is there and it worked before adding the parameters I guess the problem is adding the parameters.

when I activate the remote shell from the shell without the groovy the remote script works. How can I pass them to the remote script with groovy? thanks

最满意答案

我是作为Jenkins用户运行的。

我发现无法使用groovy将参数传递给远程脚本。 我创建了一个执行ssh命令的本地脚本,并从Jenkins groovy激活本地脚本

I was running it as Jenkins user.

I found out that it is not possible to pass parameters to a remote script with groovy. I created a local script that executes the ssh command and I activating the local script from Jenkins groovy

更多推荐