Added a function and some variable
This commit is contained in:
@@ -3,7 +3,24 @@
|
|||||||
declare -i diskUsage
|
declare -i diskUsage
|
||||||
vhostDir="/var/www/vhosts"
|
vhostDir="/var/www/vhosts"
|
||||||
|
|
||||||
diskUsage=$(df -h | grep /dev/mapper/tulup--vg-root | awk '{print $5}' | cut -d% -f1)
|
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/mapper/Fabricsy--vg-root | awk '{print $5}' | cut -d% -f1)
|
||||||
|
|
||||||
if [[ $diskUsage -ge 50 ]]
|
if [[ $diskUsage -ge 50 ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
@@ -17,26 +34,23 @@ then
|
|||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
echo -e "Rozpoczynam czyszczenie cache...\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[@]}"
|
for subscription in "${subscriptionList[@]}"
|
||||||
do
|
do
|
||||||
|
|
||||||
if [[ -d "$subscription/httpdocs/shopsystem/application/cache/boxes" ]]
|
if [[ -d "$boxesPath" ]]
|
||||||
then
|
then
|
||||||
cd "$subscription/httpdocs/shopsystem/application/cache/boxes"
|
cd "$boxesPath"
|
||||||
|
loopDirs
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "$smarty_compiledPath" ]]
|
||||||
|
then
|
||||||
|
cd "$smarty_compiledPath"
|
||||||
|
loopDirs
|
||||||
fi
|
fi
|
||||||
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"
|
cd "$vhostDir"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user