Network monitoring script
📖 Scenario: You are a system administrator who wants to keep an eye on the network status of a server. You will write a simple Bash script that checks if the server is reachable by pinging it and then reports the result.
🎯 Goal: Build a Bash script that pings a specific IP address or hostname, counts the number of successful responses, and then prints a summary message.
📋 What You'll Learn
Create a variable called
target with the IP address or hostname to pingCreate a variable called
count to specify how many ping attempts to makeUse the
ping command with the -c option to send the specified number of pings to the targetExtract the number of successful ping replies from the ping command output
Print a message showing how many pings succeeded out of the total attempts
💡 Why This Matters
🌍 Real World
Network administrators often need to monitor if servers or devices are reachable to ensure network health.
💼 Career
Knowing how to write simple network monitoring scripts helps in automating routine checks and troubleshooting connectivity issues.
Progress0 / 4 steps