在shell中运行命令,并在关闭会话时继续运行命令 [英] Run a command in a shell and keep running the command when you close the session

查看:137
本文介绍了在shell中运行命令,并在关闭会话时继续运行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Putty连接到远程服务器。我想知道的是,如果有任何方式来编写我的命令,并允许他们在关闭与Putty会话后继续运行。这样做的原因是我不想让计算机一直处于开机状态。


$ b

更新解决方案

对于我提出的问题,最好的解决方案是使用诸如 nohup 之类的命令,因为您不必安装任何其他软件。但是如果你在同样的问题使用屏幕,安装它并使用它。非常惊人。



我选择了Norman Ramsey的答案作为最喜欢的答案,因为使用命令和屏幕提出了多个解决方案。

解决方案

code> nohup , disown 屏幕都很好,但 screen 是最好的,因为不像其他两个,屏幕允许您断开远程服务器,保持一切运行,然后重新连接以后看到发生了什么。 nohup 已失效您无法恢复互动。


I am using Putty to connect to a remote server. What I want to know is if there is any way to write my commands and allow them to keep running after I close the session with Putty. The reason for this is that I do not want to keep the computer ON all the time. Is there any way to do this?.

Update with the solution

For my question as it is presented the best solution is use one of the commands provided such as nohup, because you do not have to install any additional software. But if you are in the same problem use screen, install it and use it. It is amazing.

I have selected the answer of Norman Ramsey as favourite because propose several solutions using commands and screen. But please check the other answers specially the one of PEZ, then you get an insight of what screen is able todo.

解决方案

nohup, disown, and screen are all good but screen is the best because unlike the other two, screen allows you to disconnect from the remote server, keep everything running, and then reconnect later to see what is happening. With nohup and disown you can't resume interacting.

这篇关于在shell中运行命令,并在关闭会话时继续运行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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