Search code examples
node.jsupstart

Upstart | Ubuntu | Nodejs | Can not run multiple exec inside script block


I'm trying to setup a upstart conf for my nodejs app. I have to run 2 script scrip_1.js and script_2.js. Here the conf

start on startup
stop on shutdown

respawn

console log

env PROJ=/project/path

script
    cd $PROJ
    exec node script_1.js 2>&1 >> $PROJ/logs/script_1.log
    exec node script_2.js 2>&1 >> $PROJ/logs/script_2.log
end script

The problem is only script_1.js running. If I move the exec node script_2.js... right before cd $PROJ then only script_2.js running.

How can I make this upstart conf?

Thank you!


Solution

  • Create a separate job for both script 1 and script 2.