With Copilot
Acquia Copilot is a conversational AI connected into our product documentation and knowledge base. Ask Copilot about product features, technical details, troubleshooting and how to get started with Acquia products.
Sign in to use Acquia Copilot
If you’re using a multisite installation, following best practices would have you ensure you are in the correct website directory before running a Drush command. However, if you’re using Drush across several applications in succession, using Drush aliases can be more efficient.
You must use aliases when executing Drush commands inside the docroot directory. If you’re not in the specific multisite directory for which you want to execute Drush commands, you must also specify the -l flag and provide a URI. If you use an alias by itself and you aren’t in the relevant multisite directory, Drush can’t determine which website it should execute commands for.
For example, if you want to run a pm-list (or its alias, pml) and grep for the sync module on http://www.mysite.org, use one of the following commands based on your location:
In the specific multisite installation directory (such as /var/www/html/mysite.test/sites/mysite.org)* - No additional Drush parameters are needed. Use the following command:
drush pml | grep syncIn the website’s docroot, but not the specific multisite directory (such as /var/www/html/mysite.test)
You will need the URI for the specific multisite like the following:
drush -l http://domainb.mysite.org pml | grep syncIn the infrastructure’s /var/www/html directory, but not in the Drupal installation docroot
You will need both the URI and the Drush alias like the following:
drush @mysite.test -l http://domainb.mysite.org pml | grep syncYou need the alias to specify the Drupal website application since you’re not in /var/www/html/mysite.test, and you need the URI since you’re not in the related multisite directory for http://domainb.mysite.org.
If you want to run Drush on all the multisites in an environment that uses Cloud Hooks, you can use the following command as an example, where [site] is the application, and [target.env] is the environment you want to run the command in:
drush --root=/var/www/html/[site].[target_env]/docroot @sites updatedb --yesThe @sites alias is deprecated in all versions of Drush since Drush 9.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
The @sites alias is deprecated in all versions of Drush since Drush 9.
If this content did not answer your questions, try searching or contacting our support team for further assistance.