Linux and open source articles and tutorials based on real world projects and deployments

Bash script to test websites with curl

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
site1.com
site2.com
site3.com
Then we will create a loop that will report error for any curl output from $? that is not 0