SSH,运行进程,然后忽略输出

编程入门 行业动态 更新时间:2024-10-10 14:21:07
本文介绍了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,运行进程,然后忽略输出

本文发布于:2023-11-16 02:16:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1600093.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   SSH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!