AWS: EC2 + NodeJS + Forever

I have a few ExpressJS applications that use Forever to keep things always moving. The scripts below are what I use invoke the servers.

Start

Create a my-app/start file.

#!/bin/bash
 
# Invoke the Forever module (to START our Node.js server).
./node_modules/forever/bin/forever \
	start \
	-al forever.log \
	-ao out.log \
	-ae err.log \
	../app.js

Source


Stop

Create a my-app/stop file.

#!/bin/bash
 
# Invoke the Forever module (to STOP our Node.js server).
./node_modules/forever/bin/forever stop ../app.js

Source


Start & Stop

Start

./start

Stop

./stop