
Untitled
By: a guest on
Sep 16th, 2012 | syntax:
None | size: 0.69 KB | hits: 7 | expires: Never
# Install Upstart
sudo apt-get install -y upstart
cat > /etc/init/nodeServer.conf << EOF
#!upstart
description "node.js server"
author "jsermeno"
start on startup
stop on shutdown
script
export HOME="/root"
NODE_ENV=production node /root/www/app.js 2>&1 >> /var/log/node.log
end script
EOF
chmod +x /etc/init/nodeServer.conf
# Install Monit
sudo apt-get install -y monit
cat > /etc/monit/monitrc << EOF
#!monit
set logfile /var/log/monit.log
check host nodejs with address 127.0.0.1
start program = "/sbin/start nodeServer"
stop program = "/sbin/stop nodeServer"
if failed port 3000 protocol HTTP
request /
with timeout 10 seconds
then restart
EOF