[英]Jenkins | ssh not working
I am doing ssh to servers which has password less authentication from jenkins server to these servers in /tmp/san.txt by running a shell script. 我正在通过运行Shell脚本对从jenkins服务器到/tmp/san.txt中的这些服务器的无密码身份验证的服务器执行ssh。
jenkins@pc4mobjen01:/tmp> cat check.sh
#!/bin/bash
for i in `cat /tmp/sand.txt`
do
ssh -q mpdevops@"$i"
bash /app/home/mpdevops/sand.sh
done
jenkins@pc4mobjen01:/tmp> bash check.sh
Last login: Wed Apr 19 09:20:03 2017 from 10.4.70.42
Powered by Monsoon (Version 2.2.1519) Platform: suse 11.3
Hostname : mo-97df9aafa.dc19.saas.sap.cor Name : PC19MOBDEVOPS01
Organization : saas_prod Project : dc19_production
Url : https://monsoon.mo.sap.corp/instances/mo-97df9aafa
mo-97df9aafa[PC19MOBDEVOPS01]:~ # logout
bash: /app/home/mpdevops/sand.sh: No such file or directory
But sand.sh is present. 但是存在sand.sh。
mo-97df9aafa[PC19MOBDEVOPS01]:~ # cat sand.sh
for j in `cat sand.txt`
do
ssh -q mpdevops@"$j"
sudo python /tmp/test.py
done
Please help. 请帮忙。
Try entering the command to be executed on the remote client on the same line as the actual ssh command. 尝试在与实际ssh命令相同的行上输入要在远程客户端上执行的命令。 Looks like the bash command is being executed on the local host as opposed to the client. 看起来bash命令正在本地主机而不是客户端上执行。
You should run sand.sh
on the same line with ssh
command: 您应该使用ssh
命令在同一行上运行sand.sh
:
check.sh should be: check.sh应该是:
#!/bin/bash
for i in `cat /tmp/sand.txt`
do
ssh -q mpdevops@"$i" "bash /app/home/mpdevops/sand.sh"
done
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.