Node.js Keep a node application constantly running Running and stopping a Forever daemon


Example

To start the process:

$ forever start index.js
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: index.js

List running Forever instances:

$ forever list
info:    Forever processes running

|data: | index | uid | command          | script      |forever pid|id   | logfile                |uptime        |
|------|-------|-----|------------------|-------------|-----------|-----|------------------------|--------------|
|data: | [0]   |f4Kt |/usr/bin/nodejs   | src/index.js|2131       | 2146|/root/.forever/f4Kt.log | 0:0:0:11.485 |

Stop the first process:

$ forever stop 0

$ forever stop 2146

$ forever stop --uid f4Kt

$ forever stop --pidFile 2131