Refactored native-backups-cleanup and native-disc-space-check. \n Removed hardcoded values and used parameters instead.

This commit is contained in:
2023-04-16 12:37:31 +02:00
parent 0591f927ec
commit da2d7823b8
7 changed files with 26 additions and 15 deletions

View File

@@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
[Service]
Type=oneshot
ExecStart=/bin/bash {{disc_space_check_folder}}disc-space-check.sh
ExecStart=/bin/bash {{disc_space_check_folder}}disc-space-check.sh {{size_percent_disc_space_warning}}

View File

@@ -1,13 +0,0 @@
#!/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;