optimized variable names

This commit is contained in:
2023-11-17 12:35:39 +01:00
parent 6bc6f52f5c
commit dfaa449989
47 changed files with 87 additions and 87 deletions

View File

@@ -1,14 +1,14 @@
#!/bin/sh
# @param $1 mimimum free disc space
errors=0
minimum_percent_free_disc_space="$1"
minimum_percent_cleanup_disc_space="$1"
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 "$minimum_percent_free_disc_space" ]; then
echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_free_disc_space%."
if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ]; then
echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_cleanup_disc_space%."
errors+=1;
fi
done

View File

@@ -1,13 +1,13 @@
- name: "create {{disc_space_check_folder}}"
- name: "create {{health_disc_space_folder}}"
file:
path: "{{disc_space_check_folder}}"
path: "{{health_disc_space_folder}}"
state: directory
mode: 0755
- name: create health-disc-space.sh
copy:
src: health-disc-space.sh
dest: "{{disc_space_check_folder}}health-disc-space.sh"
dest: "{{health_disc_space_folder}}health-disc-space.sh"
- name: create health-disc-space.service
template:

View File

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

View File

@@ -2,7 +2,7 @@
Description=starts health-disc-space.service
[Timer]
OnCalendar={{on_calendar_disc_space_check}}
OnCalendar={{on_calendar_health_disc_space}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=true

View File

@@ -1 +1 @@
disc_space_check_folder: "{{path_administrator_scripts}}health-disc-space/"
health_disc_space_folder: "{{path_administrator_scripts}}health-disc-space/"