Question: Hello, Please write a Linux BASH script based upon the following instructions. First create a directory within your home directory called logs. This is where
Hello,
Please write a Linux BASH script based upon the following instructions.
First create a directory within your home directory called logs. This is where we will save our outputted logs.
To get things going with log files and log rotations we will create a script in our home directory that will log its outcome. We will call this script IsTheServerUp.bash. As you may have guessed from its name, the script will check to see if a server is up. It will then log(echo) the outcome of the script to the file. We will be using the curl command to check to see if a server is up and running. The curl command is a command that connects to a url and transfers data from it. The data to transfer depends on how the command is ran but by default it will retrieve the HTML document of a web page. Use the following set of rules to write your bash script: Use the curl command to request a web page from the server e.g, curl http://www.facebook.com/ (You can use whatever webpage you want) provide the --output /devull option + argument to suppress output Check the return status ($?) to determine if there is a problem If a status of 0 is returned, log to the file a message of success. If it is not a 0, log to the file a message of error. Make sure to include the status code and the date/time stamp. An example can look like so: (check date man page on how to format the date/time stamp) NOTE: Pay attention to date format

Log your outputted messages to a file called Server_Info.log in your newly created logs directory. You can use whatever webpage you want
Apr-11-2015-04:12:00 PM (0) Web Server [www.xbox.com ] Is Online Apr-11-2015-08:39:00 PM (7) Web Server [ www.xbox.com ] Is Offliline
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
