退出SSH后如何维护命令? [英] How to maintain command after exiting SSH?

查看:117
本文介绍了退出SSH后如何维护命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PuTTy在共享主机(cPanel)上运行node.js服务器。我的问题是,即使我完全关闭PuTTy,是否也可以保留命令?我的问题是,例如当我键入 nohup node server.js&并且服务器成功运行时,在我关闭PuTTy的那一刻,我的节点服务器又关闭了。如果有一种方法可以使我的节点服务器即使完全退出PuTTy甚至关闭计算机后仍能连续运行,我会很喜欢。



我尝试了以下操作:

-nohup(如上所示),但是在我关闭PuTTy之后并不能保持连接。

-forever.js但是仍然与nohup相同。
p>

感谢我能获得的所有帮助。



编辑:只是为了澄清一下,我的问题不是我希望进程在后台运行。我的问题是即使关闭计算机也可以运行该过程。似乎很奇怪,即使我正在使用主机,也必须保持PC开机才能继续服务器进程。

解决方案

发现问题出在cPanel,因为它不支持node.js。我搬到了DigitalOcean,在那儿工作非常好。


I am using PuTTy to run a node.js server on a shared host (cPanel). My question is whether it is possible to maintain a command even after I completely close PuTTy? My issue is that when I for example type 'nohup node server.js &' and my server runs successfully, the moment I close down PuTTy, my node server goes down again. I would love it if there was a way to continously have my node server running even after exiting PuTTy completely or even shutting down my computer.

I have tried the following things:
- nohup (as seen above), however that does not maintain the connection after I close down PuTTy.
- forever.js however still same issue as nohup.

Appreciate all the help I can get.

Edit: Just to clarify, my issue is not that I want the process to run in the background. My issue is whether it is possible to run the process even while my computer is shut down. It seems weird that I have to keep my PC on in order for the server process to continue, even though I'm using hosting.

解决方案

Found out the issue was with cPanel, as it did not support node.js. I moved to DigitalOcean and it worked fantastically there.

这篇关于退出SSH后如何维护命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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