0

I have two set of commands to be executed from different directories from a shell script.

My content of the shell script is below:

echo "starting Windshaft cartodb..."
cd /home/user/Windshaft-cartodb/
node app.js development
echo "Windshaft cartodb started."

echo "starting CartoDB SQL API..."
cd /home/user/CartoDB-SQL-API/
node app.js development
echo "CartoDB SQL API started."

When I run the shell script file, the first 3 commands were running successfully. In order to run the next commands, I have to stop the previously running command by pressing Ctrl + C. Script processing continues with echo "Windshaft cartodb started." only after doing this.

My problem is: Without stopping the previously running commands, I need to execute the commands after the below commands in a new terminal.

echo "starting Windshaft cartodb..."
cd /home/user/Windshaft-cartodb/
node app.js development 

How to open a new terminal by commands in a shell script?

Mofi
  • 46,139
  • 17
  • 80
  • 143
Harnish
  • 9
  • 1
  • 3
  • You can run the first `node app.js development` in background with `&` at the end of command. so `node app.js development &` – jijinp Dec 16 '15 at 12:39
  • If i use & it goes to the next command, but it raising an error after executing next set of commands [2015-12-16 06:49:12.890] [ERROR] [default] - Uncaught exception: Error: listen EADDRINUSE at errnoException (net.js:904:11) at Server._listen2 (net.js:1042:14) at listen (net.js:1064:10) at net.js:1146:9 at dns.js:72:18 at process._tickCallback (node.js:415:13) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:902:3 – Harnish Dec 16 '15 at 12:48

1 Answers1

0

How to open a new terminal by commands in a shell script?

You can open a new terminal with the command xterm and run a program in it with its option -e:

xterm -e node app.js development&
Armali
  • 18,255
  • 14
  • 57
  • 171