-
-
Save jdomzhang/9734820 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPSTART | |
sudo vi /etc/init/<reponame>.conf | |
add inside: | |
description "<reponame>" | |
author "name" | |
env PROGRAM_NAME="<reponame>" | |
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:/root/local/lib/node_modules | |
cd /var/www/<reponame> | |
exec /root/local/bin/nodemon --exitcrash app.js 2>&1 >> /var/log/<reponame>.log | |
end script | |
pre-stop script | |
rm /var/run/$PROGRAM_NAME.pid | |
end script | |
MONIT | |
sudo vi /etc/monit/monitrc | |
(on top only the first time) | |
set daemon 120 | |
(then new repo) | |
#<reponame> | |
check process affinity with pidfile "/var/run/<reponame>.pid" | |
start program = "/sbin/start <reponame>" | |
stop program = "/sbin/stop <reponame>" | |
if failed port <repoPort> protocol HTTP | |
request / | |
with timeout 5 seconds | |
then restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment