简体   繁体   English

Npm 在 SSH 连接后在服务器后台启动 (EC2)

[英]Npm start in background on a server after SSH connection (EC2)

I have an app that I start with "npm start" I would like to run it in background.我有一个以“npm start”开头的应用程序,我想在后台运行它。 This app is hosted on aws EC2.这个应用程序托管在 aws EC2 上。

I tried:我试过了:

  • npm start & Doesnt work if I disconnect ssh connection npm 启动 & 如果我断开 ssh 连接则不起作用

  • nohup npm start & Same, it fail if I disconnect ssh connection nohup npm start & Same,如果我断开 ssh 连接,它会失败

  • I tried to launch with root, or user, doesnt make any difference.我尝试使用 root 或用户启动,没有任何区别。

  • I also tried forever but I didnt manage to launch with npm start like "forever start npm start" doesnt work我也试过永远,但我没有设法用 npm 启动启动,就像“永远启动 npm 启动”不起作用

Thanks a lot for your help非常感谢你的帮助

You have to use docker. You will need to read a lot the documentation, because it's complicated to understand if you dont know it: https://docs.docker.com/get-started/你必须使用docker。你需要阅读大量文档,因为如果你不知道它很难理解: https://docs.docker.com/get-started/

But it does exactly what you want, running app in background in a container.但它完全符合您的要求,在容器中的后台运行应用程序。 You can close everything your app will still run.您可以关闭您的应用程序仍将运行的所有内容。

Enjoy reading !享受阅读 !

I will try the docker style next time because im running out of time.下次我会尝试 docker 样式,因为我的时间不多了。 I found a way using:我找到了一种使用方法:

"screen" command ! “屏幕”命令!

Actually the process stop after few hours with screen实际上这个过程在屏幕显示几个小时后停止

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM