I'm new to shell scripting, so pardon my lack of knowledge.
My aim is to run two servers server1 and server2 in the background and then run a python script scriptRun through my shell script.
Step1:
Launch server1 (making it run in the background)
Run a few commands on this server (which are customized commands)
Step2:
- Launch server2
Step3:
- Run my python script and display its output on the terminal after server1 and server2 are launched
My shell script looks like this:
echo "Launching server1"
java StartServer1.jar && (serverCommand1 && serverCommand2) &
echo "Launching server2"
java StartServer2.jar &&
echo "Running script"
python scriptRun.py
This script does not work at all. I tried removing the serverCommand1 and serverCommand2, this works, but the python script does not wait for server2 to launch.
Also the terminal displays the outputs of server1 and server2, and not the output of the python script.
My question is how do I run multiple processes in the background and run another process which is dependent on the previous processes?