-
-
Save henvic/a06493fde04b4d4fd1ec to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# | |
# Cloud Hooks: code-deploy, code-update, db-copy, web-activate | |
# Essentially any time code or db changes are made. | |
# | |
# Purges Varnish cache for all .com domains assigned to the environment in Acquia Cloud. | |
site="$1" | |
target_env="$2" | |
drush_alias=$site'.'$target_env | |
json="$(drush @$drush_alias ac-domain-list --format=json)" | |
if [ "$?" -ne "0" ]; then | |
echo "The environment needs to have login permissions in order to purge Varnish." | |
echo "Run the following to have the environment log in securely:" | |
echo " drush @$drush_alias ssh 'drush ac-api-login'" | |
else | |
domains="$(echo $json | tr '"' '\n' | grep .com)" | |
echo "Flushing .com domains in Varnish for this environment..." | |
for domain in ${domains[@]} | |
do | |
echo " Flushing $domain" | |
drush @$drush_alias ac-domain-purge $domain | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment