Forked from payrequestio/gist:b15562c635c5e41f44e1c424ef009740
Last active
July 21, 2023 00:57
-
-
Save breakerh/5148b0b621577724f365bac29a712532 to your computer and use it in GitHub Desktop.
Magento 2 clean up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loop through all user directories in /home | |
find /home/ -type d \( -name "bin" -a ! -path "*/dev/tests/*" -a ! -path "*/vendor/magento/*" \) -exec find {} -type f -name "magento" \; | while IFS= read -r dir; do | |
processed_path=$(echo "$dir") | |
user=$(echo "$processed_path" | awk -F'/' '{print $3}') | |
echo "User: $user" | |
echo "Magento 2 installation found in: $processed_path" | |
echo "Emptying Magento 2 caches..." | |
php_version=$(ls -1 /usr/local/directadmin/data/users/"$(basename "$user")"/php/php-fpm*.conf | awk -F'php-fpm|.conf' '{print $2}' | sort -nr | head -1) | |
php_path="/usr/local/php$php_version/bin/php" | |
"$php_path" "$processed_path" cache:flush | |
wait $! | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment