#{{{application}}}-{{{process}}} # Generated by node-foreman description "{{{application}}}-{{{process}}} service" # Automatic start/stop based on {{{application}}}, which starts on bootup # To manually start/stop only this job: # /sbin/initctl start {{{application}}}-{{{process}}} # /sbin/initctl stop {{{application}}}-{{{process}}} start on starting {{{application}}} stop on stopping {{{application}}} respawn # Configuration for this daemon {{#envs}}env {{{key}}}="{{{value}}}" {{/envs}} # Not supported by older versions of Upstart, like on RHEL/CentOS chdir {{{cwd}}} setuid {{{user}}} setgid {{{group}}} # Arbitrarily high limit on number of open file descriptors limit nofile 50000 50000 # Enable core dumps limit core unlimited unlimited # How to run the application script # Abort if some part of this script fails set -e # Temporary fifo for sending log output to mkfifo /tmp/{{{application}}}-{{{process}}}-log-fifo # A logger instance that pipes the fifo to syslog ( logger -t {{{application}}}-{{{process}}} /tmp/{{{application}}}-{{{process}}}-log-fifo # Clean up the fifo so we don't leave it laying around rm /tmp/{{{application}}}-{{{process}}}-log-fifo # Run our actual application # - exec used instead of setuid, see comment above # - stderr redirection is done last so that we don't lose error messages # related to the Upstart config itself # Uncomment and use this line if you are using an older version of Upstart #exec su -m -s /bin/sh -c 'exec "$0" "$@"' {{{user}}} -- npm start 2>&1 exec {{{command}}} 2>&1 end script