From c9cf5009c1db9b76b17b43781994527d65be0572 Mon Sep 17 00:00:00 2001 From: Daniel Sosnowski Date: Wed, 3 Dec 2025 10:02:20 +0100 Subject: [PATCH 1/3] added new loop --- clearCache.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/clearCache.sh b/clearCache.sh index 98a35d8..172b142 100644 --- a/clearCache.sh +++ b/clearCache.sh @@ -19,25 +19,24 @@ then for subscription in "${subscriptionList[@]}" do - - if [[ -d "$subscription/httpdocs/shopsystem/application/cache/boxes" ]] - then - cd "$subscription/httpdocs/shopsystem/application/cache/boxes" - fi - echo -e "Czyszczę cache w subskrybcji $subscription...\n" - ls -1 > "/tmp/dirList.txt" - readarray -t dirList < /tmp/dirList.txt - for dir in "${dirList[@]}" + for path in "$subscription/httpdocs/shopsystem/application/cache/boxes"* "$subscription/httpdocs/shopsystem/appcation/cache/smarty_compiled" do - if [[ -d "$dir" ]] - then - echo -e "Czyszczenie $dir...\n" - cd "$dir" - ls -1 - cd .. - fi + cd "$path" + echo -e "Czyszczę cache w subskrybcji $subscription...\n" + ls -1 > "/tmp/dirList.txt" + readarray -t dirList < /tmp/dirList.txt + for dir in "${dirList[@]}" + do + if [[ -d "$dir" ]] + then + echo -e "Czyszczenie $dir...\n" + cd "$dir" + ls -1 + cd .. + fi + done + cd "$vhostDir" done - cd "$vhostDir" done fi From 892593ebe2207264b09d63c6abd02c26b85c0ae1 Mon Sep 17 00:00:00 2001 From: Daniel Sosnowski Date: Wed, 3 Dec 2025 10:19:56 +0100 Subject: [PATCH 2/3] . --- clearCache.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clearCache.sh b/clearCache.sh index 172b142..e3df4f6 100644 --- a/clearCache.sh +++ b/clearCache.sh @@ -3,7 +3,7 @@ declare -i diskUsage vhostDir="/var/www/vhosts" -diskUsage=$(df -h | grep /dev/mapper/Fabricsy--vg-root | awk '{print $5}' | cut -d% -f1) +diskUsage=$(df -h | grep /dev/mapper/tulup--vg-root | awk '{print $5}' | cut -d% -f1) if [[ $diskUsage -ge 50 ]] then From 1f02319909800f7c5f4e8ef46a68a8ca55ae60e2 Mon Sep 17 00:00:00 2001 From: Daniel Sosnowski Date: Thu, 4 Dec 2025 14:58:15 +0100 Subject: [PATCH 3/3] added and if instruction --- clearCache.sh | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/clearCache.sh b/clearCache.sh index e3df4f6..899d55d 100644 --- a/clearCache.sh +++ b/clearCache.sh @@ -1,5 +1,9 @@ #!/bin/bash +function loopDirs { + +} + declare -i diskUsage vhostDir="/var/www/vhosts" @@ -21,24 +25,27 @@ then do for path in "$subscription/httpdocs/shopsystem/application/cache/boxes"* "$subscription/httpdocs/shopsystem/appcation/cache/smarty_compiled" do - cd "$path" - echo -e "Czyszczę cache w subskrybcji $subscription...\n" - ls -1 > "/tmp/dirList.txt" - readarray -t dirList < /tmp/dirList.txt - for dir in "${dirList[@]}" - do - if [[ -d "$dir" ]] - then - echo -e "Czyszczenie $dir...\n" - cd "$dir" - ls -1 - cd .. - fi + + if [[ -d $path ]] + then + cd "$path" + echo -e "Czyszczę cache w subskrybcji $subscription...\n" + ls -1 > "/tmp/dirList.txt" + readarray -t dirList < /tmp/dirList.txt + for dir in "${dirList[@]}" + do + if [[ -d "$dir" ]] + then + echo -e "Czyszczenie $dir...\n" + cd "$dir" + ls -1 + cd .. + fi + done + fi + cd "$vhostDir" done - cd "$vhostDir" done - done - fi if [[ -f "/tmp/subscriptions.txt" ]] && [[ -f "/tmp/dirList.txt" ]]