Case Study Lab IV: Checking if internet works

Task Overview
Description of the task

We would like to have our own handy tool to monitor the system. Often we determine free space on the root disk drive, find the number of processes and find out if it works or does not work internet.

For this purpose, create script system-watch.sh. This script will able to:

  • [f] prints free space in root (/) disk in format #GB a #%. Desired output: “On / is free # bytes, what is # of disk capacity.”
  • [p] prints total sum of unix processes. Desired output: “There is $PROCESES processes in system, now.”
  • [i] finds that the Internet works (available) or does not (not available). Desired output: “Checking... internet works.” or: “Checking... does not works.”

If a user does not select one, or if a user enters a different option than the abovementioned program displays help.

Hint: To test the availability of the Internet, use ping. #man ping command will find that the ping option c can reduce the number of pinging.

Technical instructions

For solving the problem follow these steps:

  • Treat the number of input parameters
  • Each solution subtasks wrap up in a separate function
  • At the end of the script, create a condition that triggers a particular function for subtask
  • The condition to check that the internet is used directly in the command condition. Do not use a special variable