Chris Mendez in NodeJS, For Developers

NodeJS + Forever Scripts

Install Forever package

Download and install forever package/

npm install --save forever

Create two files

Create a start file.

nano /app_dir/start.sh

Create a stop file.

nano /app_dir/stop.sh

Start.sh

Invoke the Forever module (to START our Node.js server).

#!/bin/bash
./node_modules/forever/bin/forever \
	start \
	-al forever.log \
	-ao out.log \
	-ae err.log \
	../app.js

Stop.sh

Invoke the Forever module (to STOP our Node.js server).

#!/bin/bash
 
./node_modules/forever/bin/forever stop ../app.js