One of the key requirements of the ICT171 assignment is to produce a script with verifiable output – something that runs on the server and produces visible results. I decided to build a live server status page that updates automatically every 5 minutes.
Create a webpage (/status.html) that shows real‑time system metrics: uptime, memory usage, disk space, load average, and active network connections. The page must be accessible to anyone visiting https://talhatechub.online/status.html.
Here is the complete script (/home/ubuntu/scripts/server_status.sh):
#!/bin/bash
OUTPUT_FILE="/var/www/html/status.html"
cat > $OUTPUT_FILE << 'EOF'
<html>
<head>
<meta charset="UTF-8">
<title>Server Status - Talha's Cloud</title>
<style>
body { font-family: monospace; background: #f0f0f0; }
pre { background: #ffffff; padding: 20px; border-radius: 8px; }
</style>
</head>
<body>
<h1>Talha's Cloud Server - Live Status</h1>
<pre>
Uptime: $(uptime)
Memory usage: $(free -h | grep Mem)
Disk usage: $(df -h / | tail -1)
Load average: $(cat /proc/loadavg)
Open ports: $(ss -tun | wc -l) connections
Last updated: $(date)
</pre>
<p><a href="/">Back to homepage</a></p>
</body>
</html>
EOF
The script does three things:
uptime, free -h, df -h /, cat /proc/loadavg, and ss -tun | wc -l./var/www/html/status.html (the web server's directory).Running the script manually is not useful. I used cron, a time‑based job scheduler in Linux, to execute the script every 5 minutes.
The cron job entry:
*/5 * * * * /home/ubuntu/scripts/server_status.sh
I added it with:
(crontab -l 2>/dev/null; echo "*/5 * * * * /home/ubuntu/scripts/server_status.sh") | crontab -
Any visitor can open https://talhatechub.online/status.html and see the current server health. This satisfies the rubric's requirement for "script verifiable output" – the output is clearly visible on the public internet.
This pattern can be extended to monitor multiple servers, send email alerts if disk space is low, or generate historical graphs. For this project, the simple status page is sufficient and clearly meets the learning outcomes.