Ubuntu Nodejs / CoffeeScript Init Script

This is a basic init script for starting and stoping a Nodejs / CoffeeScript application. The example below is for a CoffeeScript app but it can be easily modified for a NodeJS app.

#!upstart

description "Apps Description"

start on filesystem
stop on shutdown

respawn
respawn limit 20 5

script
    cd /var/www/project_folder #Path to the projects root folder
    coffee server.coffee > /var/logs/app.log # Start script command and log location
end script