Answers:
不,不是。它仅在备份当前模块目录之前对其进行备份。
要创建一个SQL转储,使用
drush sql-dump > filename.sql.
但是请记住将文件移到您的webroot之外。
drush sql-dump --gzip --result-file
更新来自wranvaud的注释:
如果不指定结果文件,则将其存储在主目录下的:~/drush-backups/<db_name>/<timestamp>/<database_file>.sql.gz
,否则可以指定--result-file ='〜/ Documents /'
--result-file='~/Documents/<my_backups_folder>'
这是使用drush和Acquia-Drupal从命令行备份和还原的bash脚本解决方案:
1)在我的情况下,找到加速路径(默认情况下,加速包含在加速中)(drushpath =“ / Applications / acquia-drupal / drush”)
2)创建一个backup_ mysite文件和restore_ mysite文件,并将它们包含在您的bin文件夹路径中(例如:/ usr / local / bin)
3)编辑backup_ mysite
#!/bin/bash
# Text color variables
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
basepath="path-to-your-server-root" #4ex "/Users/monojones/www"
backuppath="$basepath/backups"
drushpath="/Applications/acquia-drupal/drush"
sitename="your-sitename"
tempdir="$backuppath/backup_$sitename"
if [ -d $backuppath ]; then
echo "Backup path finded. [ $backuppath ]"
else
echo "Creating backup path... [ $backuppath ]"
mkdir $backuppath
fi
echo "${txtylw}Backing up $sitename ... ${txtgrn}"
if [ -d "$backuppath/$sitename" ]; then
echo "Backup subdir finded."
else
echo "Creating $backuppath/$sitename"
mkdir $backuppath/$sitename
fi
echo "${txtylw}"
mkdir $tempdir
$drushpath/drush -r $basepath/$sitename sql-dump --result-file=$tempdir/data.sql
tar -pczf $tempdir/files.tgz $basepath/$sitename $systempaths
tar -pczf $backuppath/$sitename/$sitename.backup_$(date +%Y%m%d%H%M).tar.gz $tempdir
rm -rf $tempdir
4)编辑restore_ mysite
#!/bin/bash
# Text color variables
txtred=$(tput setaf 1) # Red
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
basepath="path-to-your-server-root" #4ex "/Users/monojones/www"
backuppath="$basepath/backups"
sitename="your-sitename"
drushpath="/Applications/acquia-drupal/drush"
echo "${txtylw}Restoring ${txtred}$sitename ${txtylw} database: ${txtgrn}"
FILE=`ls -1 $backuppath/$sitename/$sitename.backup_* | tail -n 1`
echo "Last backup file: ${txtpur} $FILE ${txtylw}"
mkdir temp_drupalbackup_$sitename
tar -C temp_drupalbackup_$sitename -zxvf $FILE ${backuppath:1}/backup_$sitename/data.sql
$drushpath/drush sql-drop
drush sql-cli < temp_drupalbackup_$sitename/${backuppath:1}/backup_$sitename/data.sql
rm -R temp_drupalbackup_$sitename
现在使用Drush 5非常简单
“注意:Drush 5引入了archive-dump和archive-restore命令,使您可以将代码,文件和数据库备份到一个文件中。”