0

I have a project that requires running multiple services each on a different folder and a db server.

How can I automate running all of them each in it's own terminal? entering each folder and running "npm start" on separate terminal window.

thanks.

abdul-wahab
  • 2,182
  • 3
  • 21
  • 35

3 Answers3

1

You can run like this

npm start & mongod & node public/app.js &

& makes the process run in the background so once the session is closed the server stops But you can use nohup to keep it running

Avinash
  • 1,864
  • 2
  • 21
  • 27
0

You can use this:

https://www.npmjs.com/package/concurrently

concurrently "command1 arg" "command2 arg"

Yavane
  • 85
  • 2
0

In development:

Take a look at tmux or screen. They provide an easy way to run multiple shells. You can even automate the startup (How to write a shell script that starts tmux session, and then runs a ruby script), and there are tools to configure it easily, eg. https://github.com/remiprev/teamocil

In production:

You probably don't wan't production apps/services running in a detached terminal. There are more suitable tools for that with proper logging et cetera. I have a good experience with:

helb
  • 3,154
  • 15
  • 21