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

Want to run a Node.js process in the background with a good assurance it'll stay running?  Forever (https://github.com/nodejitsu/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
PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/local/notes/app.js
case "$1" in
start) forever start $DAEMON ;;
stop) forever stop $DAEMON ;;
force-reload|restart)
forever restart $DAEMON ;;
*) echo "Usage: /etc/init.d/node {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0