fixing
This commit is contained in:
@@ -1,62 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
declare -i diskUsage
|
|
||||||
vhostDir="/var/www/vhosts"
|
|
||||||
|
|
||||||
function loopDirs {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
diskUsage=$(df -h / | grep /dev | awk '{print $5}' | cut -d% -f1)
|
|
||||||
|
|
||||||
if [[ $diskUsage -ge 50 ]]
|
|
||||||
then
|
|
||||||
|
|
||||||
cd "$vhostDir"
|
|
||||||
|
|
||||||
find . -maxdepth 1 -name "*.decostores.*" > "/tmp/subscriptions.txt"
|
|
||||||
echo -e "Wykryto subskrypcje:\n"
|
|
||||||
cat /tmp/subscriptions.txt | cut -d/ -f2
|
|
||||||
readarray -t subscriptionList < /tmp/subscriptions.txt
|
|
||||||
|
|
||||||
echo -e "\n"
|
|
||||||
echo -e "Rozpoczynam czyszczenie cache...\n"
|
|
||||||
|
|
||||||
boxesPath="$subscription/httpdocs/shopsystem/application/cache/boxes"
|
|
||||||
smarty_compiledPath="$subscription/httpdocs/shopsystem/application/cache/smarty_compiled"
|
|
||||||
|
|
||||||
for subscription in "${subscriptionList[@]}"
|
|
||||||
do
|
|
||||||
|
|
||||||
if [[ -d "$boxesPath" ]]
|
|
||||||
then
|
|
||||||
cd "$boxesPath"
|
|
||||||
loopDirs
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d "$smarty_compiledPath" ]]
|
|
||||||
then
|
|
||||||
cd "$smarty_compiledPath"
|
|
||||||
loopDirs
|
|
||||||
fi
|
|
||||||
cd "$vhostDir"
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "/tmp/subscriptions.txt" ]] && [[ -f "/tmp/dirList.txt" ]]
|
|
||||||
then
|
|
||||||
rm -r "/tmp/subscriptions.txt" "/tmp/dirList.txt"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user