westtrade
9/10/2016 - 8:54 PM

upstart script for nodejs

description "vk_socket"
author "Dio"
 
env PROGRAM_NAME="vk_socket"
 
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
 
respawn 
respawn limit 5 60
 
script
   export NODE_ENV=production
   echo $$ > /var/run/$PROGRAM_NAME.pid
   export NODE_PATH=$NODE_PATH:/home/dio/.node/node_modules
   cd /home/dio/wstmp/vkontakte/socket_server
   exec /home/dio/.node/bin/nodemon --exitcrash index.js 2>&1 >> /var/log/vk_socket.log
end script
 
pre-stop script
        rm /var/run/$PROGRAM_NAME.pid
end script