From 26ef7e00f05e1a4070889765921ffb312b24bef4 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sun, 16 Apr 2023 14:06:37 +0200 Subject: [PATCH] Solved free disc space bugs --- roles/native-free-disc-space/tasks/main.yml | 8 ++++---- .../templates/free-disc-space.service.j2 | 2 +- .../templates/free-disc-space.sh.j2 | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/native-free-disc-space/tasks/main.yml b/roles/native-free-disc-space/tasks/main.yml index 91d84e66..a9a5c17a 100644 --- a/roles/native-free-disc-space/tasks/main.yml +++ b/roles/native-free-disc-space/tasks/main.yml @@ -1,13 +1,13 @@ -- name: "create {{free_disc_space_folder}" +- name: "create {{free_disc_space_folder}}" file: - path: "{{free_disc_space_folder}" + path: "{{free_disc_space_folder}}" state: directory mode: 0755 - name: create free-disc-space.sh template: src: free-disc-space.sh.j2 - dest: "{{free_disc_space_folder}free-disc-space.sh" + dest: "{{free_disc_space_folder}}free-disc-space.sh" - name: create free-disc-space.service template: @@ -19,4 +19,4 @@ template: src: free-disc-space.timer.j2 dest: /etc/systemd/system/free-disc-space.timer - notify: restart free-disc-space.timer + notify: restart free-disc-space.timer \ No newline at end of file diff --git a/roles/native-free-disc-space/templates/free-disc-space.service.j2 b/roles/native-free-disc-space/templates/free-disc-space.service.j2 index e957ae6e..bb1a5069 100644 --- a/roles/native-free-disc-space/templates/free-disc-space.service.j2 +++ b/roles/native-free-disc-space/templates/free-disc-space.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service [Service] Type=oneshot -ExecStart=/bin/bash {{free_disc_space_folder}}free-disc-space.sh {{size_percent_free_disc_space}} +ExecStart=/bin/bash {{free_disc_space_folder}}free-disc-space.sh {{size_percent_free_disc_space}} \ No newline at end of file diff --git a/roles/native-free-disc-space/templates/free-disc-space.sh.j2 b/roles/native-free-disc-space/templates/free-disc-space.sh.j2 index f6cf93b8..000f73b0 100644 --- a/roles/native-free-disc-space/templates/free-disc-space.sh.j2 +++ b/roles/native-free-disc-space/templates/free-disc-space.sh.j2 @@ -34,6 +34,7 @@ if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ] || [ "$ nextcloud_application_container="nextcloud-application-1" if [ "$(docker ps -a -q -f name=$nextcloud_application_container)" ] ; then + echo "cleaning up docker nextcloud" && docker exec -it -u www-data $nextcloud_application_container /var/www/html/occ files:cleanup || exit 4 docker exec -it -u www-data $nextcloud_application_container /var/www/html/occ trashbin:cleanup --all-users || exit 5 docker exec -it -u www-data $nextcloud_application_container /var/www/html/occ versions:cleanup || exit 6 @@ -45,7 +46,7 @@ if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ] || [ "$ yes | pacman -Sc || exit 7 echo "cleanup finished." -elif +else echo "Sufficiend disc space available." echo "To force the freeing of disc space pass the parameter --force." fi