Created
May 22, 2012 00:02
-
-
Save aoberoi/2765555 to your computer and use it in GitHub Desktop.
Node app that will drop its own privileges, does not fork or daemonize itself, Upstart 1.3
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 app that will drop its own privileges, does not fork or daemonize itself, Upstart 1.3" | |
author "Ankur Oberoi" | |
# this script will be reading files from the local filesystem and | |
# and needs a network interface other than the loopback | |
start on (local-filesystems and net-device-up IFACE!=lo) | |
# stops when the machine is shut down | |
stop on shutdown | |
# automatically respawn the job if it exits | |
respawn | |
# respawn the job up to 99 times within a 5 second period | |
respawn limit 99 5 | |
# probably want to sent up a bunch of defaults for environment variables | |
exec /usr/local/bin/node | |
# pids? stdin, stdout, stderr? | |
script | |
export HOME="/home/user/" | |
exec sudo -u user /usr/local/bin/node /home/user/app.js 2>&1 >> /home/user/app.log | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment