Task 3
Topic: automation; scheduling; getting remote data; generating CSV.
Submission: You will create a bash script called userid_q3.sh where userid is your student number, and a text file userid_q3.cron that contains a correct cron job (this does not need to be added to the system’s actual cron tab!) These two files must be in the Q3 directory of your repository. More files may be included (e.g. a sample CSV output file), but this is optional.
Consider a situation where you have satellite internet access and that you are curious about the influence of weather on your download speed. Your task is to create and schedule a bash shell script that periodically and automatically fetches relevant information (from inside and outside your system), and writes to a valid CSV file accumulating the data over time.
Your tasks for this assignment:
1. Write a bash script called userid_q3.sh where userid is your student ID. The script takes one argument: the path of the CSV file that accrues data over time.
• Verify that the target CSV file exists and can be written to by the script; otherwise exit.
• Use the ‘date’ command with correct options to capture the current date in ISO-8601 format.
• Also capture the current time (hours and minutes). (0 marks)
• Use the ‘ip addr’ command, together with appropriate options and use of grep and cut, to get your system’s IP address.
• Use the ‘speedtest’ utility (installed on the Course VM) with appropriate options and grep and cut to capture the current download speed (number and units).
• Examine the documentation at https://github.com/chubin/wttr.in to learn how to use the ‘curl’ command to obtain weather information for a given location. Use what you’ve learned to capture the current temperature, precipitation, pressure, and UV Index for Brisbane.
• Use the various data items you’ve captured in the bash script to add a new line to the CSV data file while otherwise operating silently (i.e. not outputting anything on stdout).
See the notes below for more information and an example
2. Write a text file userid_q3.cron that contains the correct cron job information to automatically run the bash script 6 times per day (spread equally) on Mondays, Wednesdays, Fridays, and Sundays.
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.