# mailman_connector upstart script

# This is an example of an upstart script used to start/stop
# the mailman connector.  Node is provided by nvm in a home directory, and
# a pid file is kept so that monitoring daemons can watch the program.
# Respawn is used as an additional technique.
#
# Stanza from Monit that monitors pid
#
# check process nodejs
#        with pidfile /var/run/mailman_connector.pid
#        start = "/sbin/start nodejs"
#        stop = "/sbin/stop nodejs"


description "Subscribe/unsubscribe people to mailman as requested from YBDB."
author "Jonathan Rosenbaum <gnuser@gmail.com>"

start on runlevel [2345]
stop on runlevel [016]

env NVM_DIR="/home/ps/.nvm"
exec . $NVM_DIR/nvm.sh

respawn

exec nvm use 0.12
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/mailman_connector.pid  --exec /home/ps/.nvm/versions/v0.12.0/bin/node /home/ps/node.js/mailman_connector.js 9987

# If the connector requires a self-signed certificate, rather than a CA,
# make sure to provide the path to the actual corresponding certificate in database_functions.php.
# 