我有一个命令,可以在 SSH 连接后执行 SSH 并运行脚本.该脚本运行一个二进制文件.
I have a command that will SSH and run a script after SSH'ing. The script runs a binary file.
脚本完成后,我可以输入任意键,本地终端就会恢复正常状态.但是,由于该进程仍在我通过 SSH 连接的机器上运行,因此每次它登录到 stdout 时,我都会在本地终端中看到它.
Once the script is done, I can type any key and my local terminal goes back to its normal state. However, since the process is still running in the machine I SSH'ed into, any time it logs to stdout I see it in my local terminal.
如何通过将其传递给 /dev/null 来忽略此输出,而无需在本地机器上修补它?我想将输出保留在我通过 SSH 连接的机器内,并且我想在该过程开始后完全离开 SSH.但是,我可以将它传递给机器中的 /dev/null.
How can I ignore this output without monkey patching it on my local machine by passing it to /dev/null? I want to keep the output inside the machine I am SSH'ing to and I want to just leave the SSH altogether after the process starts. I can pass it to /dev/null in the machine, however.
这是我正在运行的示例:
This is an example of what I'm running:
cat ./sh/script.sh | ssh -i ~/.aws/example.pem ec2-user@11.111.11.111script.sh 的内容如下所示:
# Some stuff... # Run binary file ./bin/binary & 推荐答案用./bin/binary &>/dev/null &
更多推荐
SSH,运行进程,然后忽略输出
发布评论