Created
May 17, 2011 22:13
-
-
Save tene/977533 to your computer and use it in GitHub Desktop.
instance-based upstart configuration
This file contains hidden or 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
task | |
script | |
for port in $(seq 8080 8087) ; do | |
start platform-worker PORT=$port | |
done | |
end script |
This file contains hidden or 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 | |
description "node.js server" | |
start on startup | |
stop on shutdown | |
respawn # restart when job dies | |
respawn limit 5 60 # give up restart after 5 respawns in 60 seconds | |
instance $PORT | |
script | |
export HOME="/imvu/platform/src" | |
export NODE_PATH="/imvu/platform/src" | |
touch /var/log/imvu.log | |
su platform-admin -c "/usr/bin/node /imvu/platform/src/server.js $PORT >> /tmp/imvu.log.$PORT 2>&1" | |
end script |
This file contains hidden or 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
# Example systemd equivalent for my own notes, because I was fucking around with it | |
[Unit] | |
Description=node.js server | |
[Service] | |
User=platform-admin | |
Environment=HOME=/imvu/platform/src HOME_PATH=/imvu/platform/src | |
ExecStart=/usr/bin/node /imvu/platform/src/server.js %i | |
StandardOutput=syslog | |
SyslogIdentifier=%p (%i) | |
Restart=always | |
# Install eight workers by default on service enable | |
[Install] | |
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment