mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
optimized variable names
This commit is contained in:
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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}}
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
disc_space_check_folder: "{{path_administrator_scripts}}health-disc-space/"
|
||||
health_disc_space_folder: "{{path_administrator_scripts}}health-disc-space/"
|
Reference in New Issue
Block a user