check-disk-usage.sh (355B) - raw


      1 #!/bin/sh
      2 # 2022 Oscar Benedito <oscar@oscarbenedito.com>
      3 # License: CC0 1.0 Universal License
      4 
      5 tmp="$(df -Ph | grep ' /$')"
      6 used="$(echo "$tmp" | awk {'print $5'})"
      7 left="$(echo "$tmp" | awk {'print $4'})"
      8 max=80
      9 
     10 if [ "${used%?}" -ge "${max}" ]; then
     11     notify "Disk usage warning" "$(hostname) has used $used of its disk space. Space left: $left."
     12 fi