drupal

Backup and restore Drupal on Ubuntu

How to backup Drupal on an Ubuntu server.

Backup

Script the backing up of the database and file system (password is in .my.cnf file in user home directory):


#!/bin/sh

DRUPAL_HOME=/var/www
BACKUP_HOME=/home/ubuntu

SQL_NAME=/home/ubuntu/bhgagile-sql-dump-$(date +"%Y-%m-%d_%H-%M").sql
FILES_NAME=/home/ubuntu/bhgagile-file-dump-$(date +"%Y-%m-%d_%H-%M").tgz

cd $DRUPAL_HOME

/usr/bin/mysqldump -u root drupal > $SQL_NAME
/bin/gzip $SQL_NAME

/bin/tar -czf $FILES_NAME html

cd $BACKUP_HOME

Restoring