commit 0464d076c0d7e72a7a1342be81e41e86ef3ba026
parent 5bcaa9b2e1de15bf43a9d947d4e2619d5a8f94b7
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Fri,  7 Jan 2022 20:56:48 +0100

Add check-disk-usage

Diffstat:
Acheck-disk-usage.sh | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

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