2017-04-19 1 views
0

쉘 스크립트를 실행하여 젠킨스 서버에서 /tmp/san.txt에있는 이들 서버에 대한 인증이 덜한 서버로 ssh하고 있습니다.젠킨스 | ssh가 작동하지 않습니다

[email protected]:/tmp> cat check.sh 
#!/bin/bash 
for i in `cat /tmp/sand.txt` 
do 
ssh -q [email protected]"$i" 
bash /app/home/mpdevops/sand.sh 
done 


[email protected]:/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 

그러나 sand.sh가 있습니다.

mo-97df9aafa[PC19MOBDEVOPS01]:~ # cat sand.sh 
for j in `cat sand.txt` 
do 
ssh -q [email protected]"$j" 
sudo python /tmp/test.py 
done 

도와주세요.

+0

내가 그것을 알아 냈어. 나는 EOF를 사용해야했다. – Sandesh

답변

0

실제 ssh 명령과 동일한 줄에 원격 클라이언트에서 실행할 명령을 입력 해보십시오. bash 명령이 클라이언트가 아닌 로컬 호스트에서 실행되는 것처럼 보입니다. 해야

check.sh :

0

당신은 ssh 명령과 같은 줄에 sand.sh를 실행해야합니다

#!/bin/bash 
for i in `cat /tmp/sand.txt` 
do 
ssh -q [email protected]"$i" "bash /app/home/mpdevops/sand.sh" 
done 
관련 문제