Drush (rsync)

It's been described as the Swiss army knife for Drupal developers, and I wouldn't be without it. Drush is a fantastic tool and a great time saver - but not without issues...

I'm running a couple of multi-site installations and, as with all my sites, I use Drush to move sites between development stages and live (and sometimes back again). By default drush rsync will update everything from the site root. If you only want to update a single site from a multi-site installation, the documentation says you can use the --exclude-other-sites option...

Except it doesn't work.
I keep getting the following error message:

rsync: --exclude-other-sites-processed: unknown option
rsync error: syntax or usage error (code 1) at main.c(1453) [client=3.0.9]

I don't know why it adds "-processed" on the end, so I decided to try another tack. I already use a .rsync-filter file and the -F option; I thought, why not extend that idea to the sites directories?

I added a file to each folder in sites called .sites-filter, which contains:

+ sites/all/
+ sites/example.com/
- sites/*

Then in the command-specific section of my site-alias file I added:

'rsync' => array(
   'filter' => '._.sites-filter',
),

Shorthand for --filter="merge .sites-filter" (on my system, it has to be an underscore; a space doesn't work - I'm using bash on Ubuntu 12.04 - YMMV)

This seems to work fine - as long as my cwd is the relevant sites folder of the target website (as with Git, it is probably best practice to be in the target directory anyway..)

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.