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

13 lines
417 B
Django/Jinja

#!/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;