Skip to content

Instantly share code, notes, and snippets.

@syshen
Created December 18, 2011 07:04
Show Gist options
  • Save syshen/1492611 to your computer and use it in GitHub Desktop.
Save syshen/1492611 to your computer and use it in GitHub Desktop.
start on runlevel[12345]
stop on runlevel[06]
respawn
ulimit -n 65535
if [ -d /usr/lib/node_modules ] ; then
export NODE_PATH='/usr/lib/node_modules'
else
export NODE_PATH='/usr/local/lib/node_modules'
fi
NODE_BIN=''
if [ -f /usr/bin/node ] ; then
NODE_BIN=/usr/bin/node
else
NODE_BIN=/usr/local/bin/node
fi
exec $NODE_BIN server.js >> /var/log/your-node.log 2>&1
end script
post-start script
NODE_PID=`status your-node |egrep -oi '([0-9]+)$' |head -n1`
echo $NODE_PID >/var/run/your-node.pid
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment