Skip to content

Instantly share code, notes, and snippets.

@arturoherrero
Created October 11, 2017 15:40
Show Gist options
  • Save arturoherrero/72914fe9651b4a3849b2acfa0ee27f46 to your computer and use it in GitHub Desktop.
Save arturoherrero/72914fe9651b4a3849b2acfa0ee27f46 to your computer and use it in GitHub Desktop.

Revisions

  1. arturoherrero created this gist Oct 11, 2017.
    8 changes: 8 additions & 0 deletions disk_space.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/bin/bash

    CURRENT=$(df /dev/sda | grep / | awk '{ print $5}' | sed 's/%//')
    THRESHOLD=95

    if [ "$CURRENT" -ge "$THRESHOLD" ]; then
    echo "Subject: Disk space critical: $THRESHOLD% used" | /usr/sbin/sendmail -v [email protected]
    fi