baniol
6/29/2015 - 11:06 AM

upstart script

upstart script

lauch the service:

`initctl start express-static`
#!upstart
description "node.js simple server for loadtesting"
author      "mb"

console output

start on started sshd
stop on shutdown

limit nofile 400000 400000


chdir /home/ec2-user/express-loadtests/express-static

script
    echo $$ > /var/run/express.pid
    exec /usr/bin/node bin/www >> /var/log/express.sys.log 2>&1
end script

pre-start script
    # Date format same as (new Date()).toISOString() for consistency
    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/express.sys.log
end script

pre-stop script
    rm /var/run/express.pid
    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/express.sys.log
end script