How to Use Forever in Linux for Node.js
Table of Contents
- What is Forever?
- List All Running Forever Threads
- Stop a Specific Forever Thread
- Start a Specific Forever Thread
Introduction
Forever is an npm package for your Node.js server-side application. It allows you to keep your Node.js application running even after you log off your machine.
What is Forever?
Forever is an npm package for your Node.js server-side application. Check out the package documentation at forever npm package.
Use Forever so that even though you log off your machine, the Node.js application will still keep running. Without this, after you log off, your application will stop.
The following are a few common commands for running Forever on a Linux system.
List All Running Forever Threads
/# forever list
Stop a Specific Forever Thread
/# forever stop server.js
Start a Specific Forever Thread
The following example is similar to node server.js:
/# forever start server.js
Conclusion
Forever is a simple and effective tool for keeping your Node.js applications running in the background on Linux. With just a few commands, you can start, stop, and list your running Node.js processes.