执行shell脚本报错,通过shell调试方法,具体可以参考:
https://blog.csdn.net/weixin_42167759/article/details/80700719?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
使用调试方法后,打印出来的结果如下:
$ sh -x copyJobModelDir2JobMgtNode.sh
+ containerip=193.168.0.5
+ paasip=10.62.123.68
+ echo 'start into paas'
start into paas
+ scp -r jobmodel copy2DockerContainer.sh ubuntu@10.62.123.68:/home/ubuntu
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:Ap3Y+OkmdYsrMTatejiHOUGiklHO9JUHBAlqw1Z5ZA8.
Please contact your system administrator.
Add correct host key in /c/Users/*****/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/*****/.ssh/known_hosts:8
ECDSA host key for 10.62.123.68 has changed and you have requested strict checking.
Host key verification failed.
lost connection
+ echo 'come back to paas'
come back to paas
+ echo 'return to paas'
return to paas
+ ssh -tt ubuntu@10.62.123.68
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:Ap3Y+OkmdYsrMTatejiHOUGiklHO9JUHBAlqw1Z5ZA8.
Please contact your system administrator.
Add correct host key in /c/Users/*****/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/*****/.ssh/known_hosts:8
ECDSA host key for 10.62.123.68 has changed and you have requested strict checking.
Host key verification failed.
原来是因为远端主机的识别改变了,需要更新
ssh-keygen -R "你的远程服务器ip地址"
目的是清除你当前机器里关于你的远程服务器的缓存和公钥信息,注意是大写的字母“R”。
显示:
# Host 10.62.123.68 found: line 8
/c/Users/*****/.ssh/known_hosts updated.
Original contents retained as /c/Users/*****/.ssh/known_hosts.old
再次执行脚本成功。