I have a script that updates a web application. The web application is distributed on 2 servers. Here is a summary of the script
- The shell script updates the git repository.
- The shell script stops the application server.
- The shell script stops the web server.
- The shell script informs the application server of the latest git update.
- The shell script tells the web server to check for the latest git update.
- The shell script starts the application server.
- The shell script starts the web server.
Each of the 7 steps is performed synchronously one after the other. Total run time is about 9 seconds. However, to reduce downtime, many of these steps can be performed asynchronously.
For example, steps 4 and 5 can be performed simultaneously. I want to start steps 4 and 5 asynchronously (for example, working in the background), but I cannot find how to wait until they both end before moving on.
source share