SSH,运行进程,然后忽略输出 [英] SSH, run process and then ignore the output

查看:44
本文介绍了SSH,运行进程,然后忽略输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个命令,可以在 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.111

script.sh 的内容如下所示:

# Some stuff...

# Run binary file
./bin/binary &

推荐答案

./bin/binary &>/dev/null &

这篇关于SSH,运行进程,然后忽略输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆