Signal9Signal9 — home
online
back to labs

Server Ping Check

MediumShell Scripting20-25 min
The brief

Write a reachability checker at /root/case/pingcheck.sh. It should read the host list in /root/case/servers.txt, loop over each host, ping it, and report whether it is UP or DOWN. The script must exit cleanly (status 0) even when a host is unreachable, and it must finish on its own: grading runs it with a 20-second time limit, and a script still running at that point fails. A bare ping never stops by itself, so each probe needs a bounded packet count and a short wait. Make it executable. Grading runs the script on this list and on a host list you haven't seen, and checks that every host is pinged and reported UP or DOWN correctly.

What you'll do
  • Create an executable script at /root/case/pingcheck.sh
  • Loop over the hosts in /root/case/servers.txt
  • Ping each host and report UP or DOWN
  • Exit cleanly even when a host is down

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.