Recall & Review
beginner
What is the main purpose of a network monitoring script?
To automatically check the status and performance of network devices or connections, helping detect issues early.
Click to reveal answer
beginner
Which command is commonly used in bash scripts to check if a host is reachable?
The
ping command is used to send ICMP echo requests to test if a host is reachable.Click to reveal answer
intermediate
In a bash network monitoring script, how can you log the output of a command to a file?
Use the redirection operator
> filename to append output or > filename 2>&1 to include errors.Click to reveal answer
intermediate
What does the following bash snippet do? <br>
if ping -c 1 8.8.8.8 > /dev/null; then echo 'Up'; else echo 'Down'; fi
It sends one ping to 8.8.8.8, suppresses output, and prints 'Up' if reachable or 'Down' if not.
Click to reveal answer
beginner
Why is it useful to run a network monitoring script periodically using cron?
Because it automates regular checks without manual effort, helping catch network problems early and consistently.
Click to reveal answer
Which bash command is best to check if a website is reachable?
✗ Incorrect
The ping command sends network packets to test if a host is reachable.
What does the option '-c 1' do in the ping command?
✗ Incorrect
The '-c 1' option tells ping to send only one packet.
How can you suppress the output of a command in bash?
✗ Incorrect
Redirecting output to /dev/null discards it, suppressing display.
Which tool can schedule a network monitoring script to run every 5 minutes?
✗ Incorrect
cron is used to schedule tasks at regular intervals.
What is a simple way to log the output of a network check to a file?
✗ Incorrect
Appending >> logfile.txt saves the output to the file.
Describe how you would write a bash script to check if a server is online and log the result.
Think about sending one ping, checking success, and saving the result quietly.
You got /4 concepts.
Explain why automating network checks with scripts and scheduling tools is helpful in real life.
Consider how regular checks help avoid surprises.
You got /4 concepts.