0

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.

  • 3
    Your question is a duplicate of https://stackoverflow.com/questions/4018154/how-do-i-run-a-node-js-app-as-a-background-service and https://stackoverflow.com/questions/38773939/run-nodejs-as-a-service-on-ubuntu and https://stackoverflow.com/questions/54648839/how-do-i-run-a-node-js-app-as-a-systemd-service and https://stackoverflow.com/questions/72682044/run-node-as-a-service-with-pm2 (just the first 4 that came up in the search results). – Mark B Jun 23 '22 at 16:23
  • 3
    Does this answer your question? [How do I run a node.js app as a background service?](https://stackoverflow.com/questions/4018154/how-do-i-run-a-node-js-app-as-a-background-service) – CKE Jun 27 '22 at 03:14

0 Answers0