Service health check script
📖 Scenario: You are a system administrator who wants to monitor if important services on your server are running. You will write a simple script that checks the status of these services and reports if they are active or not.
🎯 Goal: Build a bash script that checks the health of three services: nginx, mysql, and ssh. The script will print if each service is running or stopped.
📋 What You'll Learn
Create a list of service names in a variable
Create a variable to hold the command used to check service status
Use a loop to check each service status using the command
Print the service name and its status (running or stopped)
💡 Why This Matters
🌍 Real World
System administrators often need to monitor if critical services are running to keep servers healthy and avoid downtime.
💼 Career
Knowing how to write simple health check scripts is a basic skill for IT support, DevOps, and system administration roles.
Progress0 / 4 steps