Drush

# yum install drush

用 dl 指令把最新版的 Drupal 下載回來( dl 是 download 的縮寫):

$ drush dl drupal

然後輸入以下命令,察看 drupal 與 drush 的狀態

$ drush status

接下來就可以透過 si 指令來安裝 Drupal 。 si 是 site-install 的簡寫

# drush si standard --db-url=mysql://root:d2rd0n3an@localhost/mg_gt_hwled

You are about to create a sites/default/files directory and create a sites/default/settings.php file and CREATE  the 'mg_gt_hwled' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...                                     [ok]
Installation complete.  User name: admin  User password: QPutp66kAs 

# drush upwd admin --password= 你想要的密碼

The following will download and enable the module:

# drush en module_name -y

While in the /drupal directory, create a .tar.gz back-up file containing the site database and site files with:

1
drush archive-dump

 

To copy the file to a remote backup location, use the rsync command. Replace the date-time-stampexamplesitename.date-time-stamp.tar.gzuser,ip-address, and /user/ with the appropriate inputs:

1
rsync -avz /home/user/drush-backups/achive-dump/date-time-stamp/examplesitename.date-time-stamp.tar.gz user@ip-address:/home/user/

To revert back to a previously saved version of your site:

1
drush archive-restore /home/user/drush-backups/achive-dump/date-time-stamp/examplesitename.date-time-stamp.tar.gz

 

On the Drupal hosting Linode, create a Bash script file. In the file excerpt below, replace example.com and the rsync command inputs from step 2 above:

1
nano drupal-backup.sh
~/drupal-backup.sh
1
2
3
4
5
#!/bin/bash
# Drupal Backup Script
cd /var/www/example.com/public_html/drupal/
drush archive-dump
rsync -avz /home/local-user/drush-backups/archive-dump/ remote-user@remote-ip-address:/home/user/
https://www.linode.com/docs/websites/cms/themes-modules-backups-drupal-drush-on-debian-7
Tags