I'm using Windows. Currently every time I restart my server I have to run a bunch of commands to get my servers up and running and I'd like to consolidate them into a single batch script if possible.
Here's the process I currently have to run through:
open command prompt
cd /mongodb/bin
mongod
open another command prompt
cd /forum
node proxy.js
open another command prompt
cd /forum
node app.js
open ANOTHER command prompt
cd /game
node app.js
I feel like there is definitely a better way to do this but I can't seem to find an appropriate solution.
If you place a batch file in the directory where all these folders are (I guess its your nodejs directory), you can create a start.bat
file containing the commands:
start mongodb/bin/mongod
start node forum/proxy.js
start node forum/app.js
start node game/app.js
This will execute every command simultaneously, in a separate window.
Save this as a file with a .bat
extension and you are done
Old answer:
mongodb/bin/mongod
node forum/proxy.js
node forum/app.js
node game/app.js
Or if you want all the processes to run in a separate window:
start cmd /k mongodb/bin/mongod
start cmd /k node forum/proxy.js
start cmd /k node forum/app.js
start cmd /k node game/app.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With