Is there a way to have a Ubuntu server automatically restart a NPM process if it fails?

Viewed 33

I am running a Discord bot on AWS. Is it possible to have AWS redo npm start if for whatever reason the process stops running?

I couldn't find anything like this on AWS help center.

1 Answers

I think something like PM2 should help you out.

From their description:

PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.

Related