Backup and Upgrade with drush

One of the biggest features of drush is the ease of doing site upgrades. With security updates coming every few days, automating the process is essential.

As always, you need to cd to the site's document root folder.

Backups

Creating an archive of the site is the first step. The simplest approach is:

sudo drush archive-dump

which puts a tgz of both the document root and a sql dump into ~/drush-backups.

Doing Upgrades

First, check whether upgrades are available for core plus modules:

drush up -n | grep available

This provides a list of available upgrades for core, modules and themes.

The, proceed with the upgrade:

sudo drush up

which upgrades everything, or upgrade an individual module:

sudo drush up views

which upgrades only the views module. Themes work the same way.

Tags: