2023-04-16 09:59:54 +02:00
|
|
|
#!/bin/sh
|
2023-04-16 12:37:31 +02:00
|
|
|
# @param $1 mimimum free disc space
|
2023-04-16 09:59:54 +02:00
|
|
|
errors=0
|
2023-04-16 12:37:31 +02:00
|
|
|
minimum_percent_free_disc_space="$1"
|
2023-04-16 09:59:54 +02:00
|
|
|
echo "checking disc space use..."
|
|
|
|
df
|
|
|
|
for disc_use_percent in $(df --output=pcent | sed 1d)
|
|
|
|
do
|
|
|
|
disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//")
|
2023-04-16 12:37:31 +02:00
|
|
|
if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ]; then
|
|
|
|
echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_free_disc_space%."
|
2023-04-16 09:59:54 +02:00
|
|
|
errors+=1;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
exit $errors;
|