Disk Usage Percentages With Alerts
The storage team's collector writes lines like data01 734003200 1073741824 (NAME USED_BYTES TOTAL_BYTES). Bash arithmetic is integer-only, so the old script printed 68% for 68.4 and 0% for small values.
Write /home/student/bin/disk-pct.sh [THRESHOLD] < input.
NAME PCT%, where PCT is USED / TOTAL × 100 with one decimal (rounded), for example data01 68.4%.PCT is at or above THRESHOLD (default 90), append ALERT to that line.TOTAL of 0 prints NAME n/a.About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of Shell Scripting for Automation. Next step: A Table That Lines Up
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.