如何保持我的应用程序始终运行? - 节点JS

发布于 2025-02-09 20:30:49 字数 619 浏览 2 评论 0原文

我将应用程序部署到AWS EC2上,因此我需要一种让该节点应用程序运行的方法,无论服务器是否重新启动,如果应用程序崩溃了是否始终需要重新启动该应用程序。 该应用需要始终运行。因此,我使用npm start&是否足以重新启动我的应用?

我尝试使用SystemD,但是在启动创建的服务时我有错误:

sudo systemctl start nameX.service

namex的工作。服务失败,因为资源不可用或 另一个系统错误。请参阅“ SystemCtl状态...服务”和 详细信息“ Journal Cttl -Xeu ....服务”。

 sudo systemctl status nameX.service

namex.service:计划重新启动作业,重新启动> Systemd [1]:停止 我的节点服务器。无法加载环境文件> Systemd [1]: ...服务:无法运行“启动”任务:no> Systemd [1]:...服务: 结果“资源”失败。 Systemd [1]:无法启动我的节点 服务器。

I deployed my app to aws EC2 so I need a way of always having this node app running no matter what if the server restart if the app crashes whatever it always need to restart the app.
the app needs to running always. so I use npm start & is that enough to restart my app?

I've tried to use systemD, but I had error while start the service I've created :

sudo systemctl start nameX.service

Job for nameX.service failed because of unavailable resources or
another system error. See "systemctl status ...service" and
"journalctl -xeu ....service" for details.

 sudo systemctl status nameX.service

nameX.service: Scheduled restart job, restart > systemd[1]: Stopped
My Node Server. Failed to load environment file> systemd[1]:
...service: Failed to run 'start' task: No > systemd[1]: ...service:
Failed with result 'resources'. systemd[1]: Failed to start My Node
Server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文