From b0fc3fb9531c82854aced3366b3ace3972786ffc Mon Sep 17 00:00:00 2001 From: szaimen Date: Wed, 8 Dec 2021 22:35:09 +0100 Subject: [PATCH] address review Signed-off-by: szaimen --- Containers/mastercontainer/cron.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Containers/mastercontainer/cron.sh b/Containers/mastercontainer/cron.sh index cd9c9b6d..b0019f85 100644 --- a/Containers/mastercontainer/cron.sh +++ b/Containers/mastercontainer/cron.sh @@ -2,8 +2,16 @@ set -eux while true; do + # Check for updates and send notification if yes sudo -u www-data php /var/www/docker-aio/php/src/Cron/cron.php + # Remove dangling images sudo -u www-data docker image prune -f - sudo -u www-data docker volume prune -f + # Remove dangling volumes + unset DANGLING_VOLUMES + DANGLING_VOLUMES="$(sudo -u www-data docker volume ls --filter dangling=true | awk '{print $2}' | grep -v "nextcloud_aio_\|^VOLUME$")" + mapfile -t DANGLING_VOLUMES <<< "$DANGLING_VOLUMES" + for volume in "${DANGLING_VOLUMES[@]}"; do + sudo -u www-data docker volume rm "$volume" + done sleep 1d done