我在下面的命令中使用scp和ssh连接,但仍然得到“被信号1杀死”。错误。
scp示例:
$ scp -q '-oProxyCommand=ssh -W %h:%p {user}@{jump_server}' /path/file.txt
{user}@{server2}:/tmp/
Killed by signal 1.
ssh示例:
$ ssh -A -J {user}@{jump_server} -q -o BatchMode=yes -o ServerAliveInterval=10 {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
我尝试使用-t:
$ ssh -t -A -J {user}@{jump_server} -t -q -o BatchMode=yes -o ServerAliveInterval=10 {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
我尝试使用LogLevel:
$ ssh -o LogLevel=QUIET -A -J {user}@{jump_server} -q -o BatchMode=yes -o ServerAliveInterval=10 -o LogLevel=QUIET {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
我尝试使用ProxyCommand选项:
$ ssh -q -oProxyCommand="ssh -W %h:%p {user}@{jump_server}" -q -o BatchMode=yes -o ServerAliveInterval=10 {user}@{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
如何在bash脚本的命令行中隐藏此错误消息?
发布于 2019-02-09 00:26:37
将2>/dev/null
添加到ssh命令:
$ ssh -q -oProxyCommand="ssh -W %h:%p {user}@{jump_server}“2>/dev/null
发布于 2021-02-11 00:20:37
如果你需要查看错误,你可以通过sed
$ ssh ... 2>&1 | sed '/^Killed by signal.*/d'
https://stackoverflow.com/questions/54352694
复制相似问题