Anonymous Anonymous - 1 month ago
166 0

This bash script will check the diskspace for a particular drive. When the threshold is met an email will be send.

Bash

Bash script to check diskspace

#!/bin/bash
# in this example we are going to check drive: /dev/vda1
DISKUSAGE=$(df -h /dev/vda1 | awk 'NR == 2{print $5}' | tr -d '%')
# above 80% disk usage
if (( $DISKUSAGE > 80 ))
then
mail -s "DISK USAGE server is high!" my@email.com <<< "Current usage: $DISKUSAGE"
fi
Comments