We will look at very basic script which will make sure multiple websites are up and running. This is very basic script that utilities power of Linux tool called curl. Curl is well know tool used to automate url related tasks and much more.
The basic script will use variable called $LIST_OF_WEBSITES which will contain list of websites we need to test. In our example
Then we will create a loop that will report error for any curl output from $? that is not 0
#!/bin/bash $LIST_OF_WEBSITES=" site1.com site2.com site3.com " for i in $LIST_OF_WEBSITES; do curl -Is http://$i/ > /dev/null if [ $? -ne 0 ] then echo -e "$i \e[91m [DOWN]\e[0m" else echo -e "$i \e[92m [OK]\e[0m" fi done