computer-playbook/roles/native-disc-space-check/templates/disc-space-check.sh.j2

13 lines
417 B
Plaintext
Raw Normal View History

2023-04-16 09:59:54 +02:00
#!/bin/sh
errors=0
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/%//")
if [ "$disc_use_percent_number" -gt "{{size_percent_disc_space_warning}}" ]; then
echo "WARNING: $disc_use_percent_number exceeds the limit of {{size_percent_disc_space_warning}}%."
errors+=1;
fi
done
exit $errors;