Managing a Node.js server process with forever and an LSB-style init script for Debian

Date: Sat Apr 26 2014 Management »»»» Forever
Want to run a Node.js process in the background with a good assurance it'll stay running?  Forever ( provides some level of management and monitoring that a process you put in the background will keep running, and be restarted if it crashes.  Additionally you're likely to want to have the process (forever plus your server) started automagically when the system boots up.

This shell script is a not-quite-LSB-compliant init script that works on Debian (if you ignore a warning that's printed when you install it) and should demonstrate a little about using Forever.

#! /bin/sh -e
set -e
case "$1" in
start) forever start $DAEMON ;;
stop) forever stop $DAEMON ;;
forever restart $DAEMON ;;
*) echo "Usage: /etc/init.d/node {start|stop|restart|force-reload}"
exit 1
exit 0