I have an
upstart script that runs a nodejs-app, but
Node.js is installed with
nvm. I source some variables to
upstart from another file, and my
script section looks like this:
script . /etc/default/nodejs exec start-stop-daemon --start --make-pidfile --pidfile /var/run/app.pid --chdir /home/node-apps/ --chuid root:root --exec $NODE_NVM_PATH app.js >> /var/log/node/app.log 2>&1 end script
/etc/default/nodejs (chmod 744) I have this:
with the idea that
which node outputs the nodejs' path installed via
nvm; because if I update or change the
Node.js version, I don't want to edit the new path in this file.
But using this method, don't works and my
app.js it is not running. I have also tried
export NODE_NVM_PATH=$(which node), and the same result.
But if I put:
/etc/default/nodejs everything works perfectly.
So my question is:
How can I get the execution of a
which node in this other file and source it to upstart?
I have also an enviromment variable called
$NVM_BINthat outputs the nodejs'path, but don't know also how to source it to upstart.
execinstructions in deed, are only in one line; I pasted here in separated lines to avoid scrolling