即使在用户注销后也保持节点处于运行状态 [英] Keep node in running state even after user log-off
问题描述
即使用户注销,如何保持节点应用程序在 Windows 中运行?即使在用户注销后,如何继续运行节点 http-server?
How to keep a node application running in windows even when user logs off? Also how to keep running a node http-server even after user log-off?
推荐答案
您有两个不错的选择.一个是在上面的评论中提到的Forever.
You have 2 great options. One is as mentioned in comments above Forever.
另一个是 PM2,它易于安装并提供大量选项.我在所有项目中都使用它,但我无法证明 Windows 版本,因为我在 Linux &Ubuntu 服务器并在 Mac 上工作.您可以守护您的节点进程,跟踪日志,将其集群化,并确保即使服务器关闭(它是一项服务)该进程也会重新启动.
The other is PM2 which is easy to install and offers an incredible amount of options. I use this in all projects, but I cannot attest to the Windows version as I am on Linux & Ubuntu servers and work on a Mac. You can daemonize your node process, follow logs, cluster it and make sure the process reboots even with a server shutdown (it is a service).
这篇关于即使在用户注销后也保持节点处于运行状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!