如何抑制ssh跳转连接上的"killed by signal 1."错误
How to suppress "killed by signal 1." error on ssh jump connection
我正在通过以下命令使用 scp 和 ssh 连接,但仍然收到 "killed by signal 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 脚本的命令行中抑制此错误消息?
将2>/dev/null
添加到ssh命令:
$ ssh -q -oProxyCommand="ssh -W %h:%p {user}@{jump_server}" 2>/dev/null
如果您需要查看错误,您可以通过 sed
:
$ ssh ... 2>&1 | sed '/^Killed by signal.*/d'
我正在通过以下命令使用 scp 和 ssh 连接,但仍然收到 "killed by signal 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 脚本的命令行中抑制此错误消息?
将2>/dev/null
添加到ssh命令:
$ ssh -q -oProxyCommand="ssh -W %h:%p {user}@{jump_server}" 2>/dev/null
如果您需要查看错误,您可以通过 sed
:
$ ssh ... 2>&1 | sed '/^Killed by signal.*/d'