Solved free disc space bugs

This commit is contained in:
Kevin Veen-Birkenbach 2023-04-16 14:06:37 +02:00
parent fbef73b3d4
commit 6a26a2eb5b
3 changed files with 7 additions and 6 deletions

View File

@ -1,13 +1,13 @@
- name: "create {{free_disc_space_folder}" - name: "create {{free_disc_space_folder}}"
file: file:
path: "{{free_disc_space_folder}" path: "{{free_disc_space_folder}}"
state: directory state: directory
mode: 0755 mode: 0755
- name: create free-disc-space.sh - name: create free-disc-space.sh
template: template:
src: free-disc-space.sh.j2 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 - name: create free-disc-space.service
template: template:
@ -19,4 +19,4 @@
template: template:
src: free-disc-space.timer.j2 src: free-disc-space.timer.j2
dest: /etc/systemd/system/free-disc-space.timer dest: /etc/systemd/system/free-disc-space.timer
notify: restart free-disc-space.timer notify: restart free-disc-space.timer

View File

@ -4,4 +4,4 @@ OnFailure=systemd-email@%n.service
[Service] [Service]
Type=oneshot 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}}

View File

@ -34,6 +34,7 @@ if [ "$disc_use_percent_number" -gt "$minimum_percent_free_disc_space" ] || [ "$
nextcloud_application_container="nextcloud-application-1" nextcloud_application_container="nextcloud-application-1"
if [ "$(docker ps -a -q -f name=$nextcloud_application_container)" ] ; then 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 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 trashbin:cleanup --all-users || exit 5
docker exec -it -u www-data $nextcloud_application_container /var/www/html/occ versions:cleanup || exit 6 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 yes | pacman -Sc || exit 7
echo "cleanup finished." echo "cleanup finished."
elif else
echo "Sufficiend disc space available." echo "Sufficiend disc space available."
echo "To force the freeing of disc space pass the parameter --force." echo "To force the freeing of disc space pass the parameter --force."
fi fi