File tree Expand file tree Collapse file tree
projects/02_disk_space_checker/bash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,20 +21,20 @@ while read -r LINE; do
2121 MOUNT=$( echo " $LINE " | awk ' {print $6}' )
2222
2323 # Conditional: check if usage exceeds threshold
24- if [ " $USAGE " -ge " $THRESHOLD " \ ; then
24+ if [ " $USAGE " -ge " $THRESHOLD " ] ; then
2525 echo " ⚠️ ALERT: $FILESYSTEM mounted on $MOUNT is at ${USAGE} % (threshold: ${THRESHOLD} %)"
2626 echo " $DATE | ALERT | $FILESYSTEM ($MOUNT ) at ${USAGE} %" >> " $ALERT_LOG "
27- ALERT_COUNT$(( ALERT_COUNT + 1 ))
27+ ALERT_COUNT= $(( ALERT_COUNT + 1 ))
2828 else
2929 echo " ✅ $FILESYSTEM mounted on $MOUNT is at ${USAGE} %"
3030 fi
3131 done < <( df -H -x tmpfs -x devtmpfs | tail -n +2)
3232
3333# ------------ Summary -----------------------------
3434echo " ---------------------------------------"
35- if [" $ALERT_COUNT " -gt 0 ]; then
35+ if [ " $ALERT_COUNT " -gt 0 ]; then
3636 echo " ⚠️ $ALERT_COUNT filesystem(s) over ${THRESHOLD} % threshold!"
37- echo" Alerts logged to: $ALERT_LOG "
37+ echo " Alerts logged to: $ALERT_LOG "
3838else
3939 echo " ✅ All filesystems are within the ${THRESHOLD} % threshold."
4040fi
You can’t perform that action at this time.
0 commit comments