From c83fd35b80fd80036c98a8929f46fb428125929f Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Tue, 19 Mar 2024 06:38:37 +0100 Subject: [PATCH] fix --- check-disk-space.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check-disk-space.sh b/check-disk-space.sh index a431235c..f1f69983 100755 --- a/check-disk-space.sh +++ b/check-disk-space.sh @@ -10,13 +10,13 @@ filesystems=$(df -h -x tmpfs --output=target,pcent | tail -n +2) while IFS= read -r line; do # Extract filesystem and usage percentage filesystem=$(echo "$line" | awk '{print $1}') - usage=$(echo "$line" | awk -F'%' '{print $1}') + usage=$(echo "$line" | awk '{print $NF}' | tr -d '%') # Check if usage is a number if [[ $usage =~ ^[0-9]+$ ]]; then # Check if usage is above the threshold if [ "$usage" -ge "$threshold" ]; then - echo "WARNING: Filesystem $filesystem is $usage% full!" + echo "WARNING: $filesystem is $usage% full!" fi else # Skip the line if usage information cannot be parsed