Q:

Running a node app in ubuntu

I have a node application that I basically run in 4 steps since I also need to run MongoDB and Redis:
mongod --config=/etc/mongod.conf
service redis start
npm run local
npm run work-local

Right now I basically open 2 tabs, run Redis server (which runs in the bg) then I execute the mongod line which basically hangs there so I open another tab and execute a shell script containing both npm commands.
How can I make a script to make them all run with one command? If I disconnect from the ssh session it stops, but I want it to run forever.

A:

I ended up using pm2 to run all my node apps in one command while keeping them alive constantly. It was more than I was looking for, and I'm super happy with it.

