From 9398a14b99daaf92c0a3ab439ca5f7ed13398eea Mon Sep 17 00:00:00 2001 From: sujiba Date: Mon, 16 Sep 2024 22:33:45 +0000 Subject: [PATCH] =?UTF-8?q?low-disk-space.sh=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- low-disk-space.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 low-disk-space.sh diff --git a/low-disk-space.sh b/low-disk-space.sh new file mode 100644 index 0000000..598f5ae --- /dev/null +++ b/low-disk-space.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +mingigs=2 +avail=$(df | awk '$6 == "/" && $4 < '$mingigs' * 1024*1024 { print $4/1024/1024 }') +topicurl=https://ntfy.domain.tld/topic +token=token + +if [ -n "$avail" ]; then + curl \ + -d "Only $avail GB available on the root disk. Better clean that up." \ + -H "Title: Low disk space alert on $(hostname)" \ + -H "Priority: high" \ + -H "Tags: warning,cd" \ + -H "Authorization: Bearer $token" \ + $topicurl +fi \ No newline at end of file