1

In my server's root folder I have the folder www that contains sites of all my websites. All of these are Drupal.

Navigating into each folder and doing drush --no-backup up -y each time, can be both time consuming and tiring.

Is there a way to update all sites at once, with drush, instead of installing third-party software (like Ansible, IINW).

The command drush --no-backup up -y @sites won't help in this case, as it is aimed for multisites, and I don't work with multisites at all.

Update 1 - Note (might not be relevant when you read this question):

<?php
$aliases['mine'] = array(
'site-list' => array('@site1', '@site2')
);

The file containing it should be putted under public_html (or www) with permissions as 755 or 644.

4

First off, look to the trivial solution:

#!/bin/bash
drush @site1 up -y --no-backup
drush @site2 up -y --no-backup

You don't need to install Ansible to start automating; simple bash scripts can be used to combine repetitive tasks very easily. If you are on Windows, you can install Git for Windows, which includes a Bash shell, or, if you really don't want to install anything at all, use a .bat file.

There is also a Drush solution: Drush can run the same command on multiple sites if you give it a list of aliases:

drush @site1,@site2 up -y --no-backup

If you have a lot of sites, you can make a site alias that is a list of site aliases:

<?php
$aliases['mine'] = array(
  'site-list' => array('@site1', '@site2')
);

Then:

drush @mine up -y --no-backup
  • About the direct drush solution - Just to try, in CentOS terminal I Went to www folder and did: drush @site1,@site2,@site3,@site4,@site5 --no-backup up -y but then I got "Warning: not found". – JohnDoea Sep 7 '16 at 15:43
  • Oh okay I get it, I need to give the folder names... – JohnDoea Sep 7 '16 at 15:44
  • Well, still "Not found" even when I did in www: drush @first.co.il,@second.co.uk,@third.com --no-backup up -y but then I got "Warning: not found" – JohnDoea Sep 7 '16 at 15:48
  • You need to define site aliases for all of your sites. See github.com/drush-ops/drush/blob/master/examples/… – greg_1_anderson Sep 7 '16 at 15:52
0

A solution I like that automates the process even further then what I described, is using the Unix cron to update Drush:

0 0 0 * 10  cd /var/www/html/example.com && drush up -y

Or, if You don't want backups:

0 0 0 * 10  cd /var/www/html/example.com && drush --no-backup up -y

These codes, go to the site dir and updates the site in the tenth day of each month.

As for now, I prefer give this direction for the user root's cron...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.