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,13 +1,13 @@
|
||||
- name: "create {{free_disc_space_folder}}"
|
||||
- name: "create {{cleanup_disc_space_folder}}"
|
||||
file:
|
||||
path: "{{free_disc_space_folder}}"
|
||||
path: "{{cleanup_disc_space_folder}}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: create cleanup-disc-space.sh
|
||||
template:
|
||||
src: cleanup-disc-space.sh.j2
|
||||
dest: "{{free_disc_space_folder}}cleanup-disc-space.sh"
|
||||
dest: "{{cleanup_disc_space_folder}}cleanup-disc-space.sh"
|
||||
|
||||
- name: create cleanup-disc-space.service
|
||||
template:
|
||||
|
@@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash {{free_disc_space_folder}}cleanup-disc-space.sh {{size_percent_free_disc_space}}
|
||||
ExecStart=/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}
|
@@ -2,8 +2,8 @@
|
||||
# @param $1 mimimum free disc space
|
||||
# @param $2 --force to for execution indepentend on how much disc space is free
|
||||
|
||||
execute_free_disc_space=0
|
||||
minimum_percent_free_disc_space="$1"
|
||||
execute_cleanup_disc_space=0
|
||||
minimum_percent_cleanup_disc_space="$1"
|
||||
force_freeing=false
|
||||
echo "Checking free disc space..."
|
||||
df
|
||||
@@ -14,12 +14,12 @@ fi
|
||||
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
|
||||
if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ]; then
|
||||
echo "WARNING: $disc_use_percent_number exceeds the limit of {{size_percent_disc_space_warning}}%."
|
||||
execute_free_disc_space+=1;
|
||||
execute_cleanup_disc_space+=1;
|
||||
fi
|
||||
done
|
||||
if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ] || [ "$force_freeing" = true ]; then
|
||||
if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ] || [ "$force_freeing" = true ]; then
|
||||
echo "cleaning up /tmp" &&
|
||||
find /tmp -type f -atime +10 -delete || exit 1
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Description=starts cleanup-disc-space.service
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{on_calendar_free_disc_space}}
|
||||
OnCalendar={{on_calendar_cleanup_disc_space}}
|
||||
RandomizedDelaySec={{randomized_delay_sec}}
|
||||
Persistent=true
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
free_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/"
|
||||
cleanup_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/"
|
Reference in New Issue
Block a user