#!/bin/bash
admin="[email protected]"
threshold="85"
df -l --output=source,pcent | while IFS=" %" read -r part i; do
if [ $i -ge $threshold ] 2>/dev/null; then
echo "$part is currently at ${i}%. An email has been sent to your administrator."
mail -s "Critical Alert: $part is currently at ${i}%. Clear space immeadiately!" $admin
fi
done