October 2018
Beginner
232 pages
7h 52m
English
Let's now create our web.sh bash script, which will handle the provisioning of our web servers. This script is much simpler than the load balancer script we created earlier, as follows:
#!/bin/bashecho 'Starting Provision: web'$1 sudo apt-get update sudo apt-get install -y nginx echo "<h1>Machine: web"$1 "</h1>" > /var/www/html/index.html echo 'Provision web'$1 'complete'
Again, in the preceding snippet, we are echoing out the progress at the beginning and end of our provision progress. In lines 2-4 we are updating Ubuntu and installing nginx. In line 5 we are overwriting the default index HTML file with a basic title, which will help us differentiate between the two web servers.
In this script you will notice the use of $1. This is ...
Read now
Unlock full access