Search code examples
node.jsubuntuupstartforever

Two forever instances with upstart


I'm trying to start two forever instances but it doesn't work

#Start node@4040 node@5050 con forever

description "node@4040 node@5050"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown


script
    cd /var/node/
    exec forever start -l /var/node/logs/for5050.log -o /var/node/logs/out5050.log -e /var/node/logs/err5050.log app.js 5050
    exec forever start -l /var/node/logs/for4040.log -o /var/node/logs/out4040.log -e /var/node/logs/err4040.log app.js 4040
end script

What's the problem? Thank you.


Solution

  • Each process exec must be in its own conf file. So in your case, you need to create 2 upstart conf files for each of your nodejs programs. The same conf file cannot run multiple exec commands.