I have a situation that I need to run different executables from different linux directories. The executables communicate through IP/TCP and the master-worker concept. Here I have a master directory which contains the master executable and different worker directories which contain the worker executables. Here is an example of what I'm trying to do:
A- I have a master directory : /home/usr/scratch/master
B- I create an exact copy of master copy called it wrk1
:/home/usr/scratch/wrk1
C- cd to master directory and run the exe command:
./exe arg1 /h :4004
where 4004 is a port number and arg1 and /h are just some arguments of exe
D- cd to wrk directory and run the following commands:
./exe_wrk arg1 /h host:4004
Where host is the hostname of master directory
I wrote a simple sh script :
1- cd /home/usr/scratch/master
2- ./exe /h :4004
3- cd /home/usr/scratch/wrk1
4- ./exe /h host:4004
The problem is the program when I run the master exe, it pauses and waits for other worker exe to run. In another word, my script pauses at step 2 so it never get to step 3 and four to run the workers. I can do it manually by opening another terminal and run workers but is there any way that I can run it automatically?