Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Backup and migrate has integration with Drush but the readme.txt has no mention on how to use it.
drush bam backup - seems to work but how do I create a zipped backup?
drush bam restore - I can't get it to work
There are 2 sources - db and files but how do I use it to restore. There are no destinations.
Comments
Comment #1
supersteph CreditAttribution: supersteph commentedsubscribe
Comment #2
ericdfields CreditAttribution: ericdfields commentedIt works like this
drush bam-restore db manual "nodes.mysql"
The bam-restore args are source, destination, file, and file must be in quotes.
To get a list of destinations, run drush bam-destinations.
Filename must be in quotes. That took a lot of trial and error to figure out…
Comment #3
ericdfields CreditAttribution: ericdfields commented… and I only got destinations working when I applied this patch: http://drupal.org/node/715472
(how does one 'subscribe' to updates on a thread here??)
Comment #4
supersteph CreditAttribution: supersteph commentedthanks for the link to that patch! i've been wondering about that, but hadn't taken the time to search
re: drush - i would *highly* recommend upgrading to drush v3. there were evidently a ton of bugs in v2.x that have been resolved. and thank goodness for that! can you imagine going back to life without drush??
if you do upgrade, however, take note of the remarks about spaces in the readme. you will have to uncomment a line in one of the php files to allow spaces until the bam module's drush script is updated.
re: subscribing - unfortunately (afaik) there is no way to enable email notifications on this forum. i know it seems crazy...but it's true. hopefully they'll find a solution when d.o is upgraded...
Comment #5
ronan CreditAttribution: ronan commentedThe latest dev is Drush 3 compatible thanks to mikey_p #720580: Drush 3.0 doesn't allow spaces in commands so I think I can close out this ticket.
Comment #7
raven_web CreditAttribution: raven_web commentedThank you for that clarification ericdfields, #2 got it working for me.
Comment #8
charlie-s CreditAttribution: charlie-s commentedIf I wanted to run something like this via cron, to restore my database form the latest backup every day at midnight (or w/e the case may be), how could I get the filename of the latest backup?
Comment #9
loopduplicateto get the name of the latest file added to a single directory:
ls -t1 | head -n1
so, to use drush to restore the latest backup from the manual backup folder, to the default database:
to get the name of the latest file added to a directory tree:
find . -not -type d -printf "%p\n" | sort -n | tail -1
so, to use drush to restore the latest backup from any directory in the backup_migrate folder:
Cheers!
Comment #10
bserem CreditAttribution: bserem commentedexcellent idea but I can't make it work!
any ideas?
Comment #11
z3cka CreditAttribution: z3cka commentedI got tripped up over this as well because when you run, for example:
drush bam-backups scheduled
You will get something like:
Notice that the file extension is not included in the above output. Adding .mysql did not help me because the default backup profile has "GZip" selected as the compression. This causes the backup file to have .mysql.gz as the file extension.
The command that worked for me was:
drush bam-restore db scheduled "drupstage-2012-06-19T16-16-33.mysql.gz"
I Hope that helps some one that was struggling to get this to work, like I was.
Comment #12
rwilson0429 CreditAttribution: rwilson0429 commentedYelp, that helped someone, me. Thank you very much z3cka. It's an old post but the solution provided in #11 still works today (6/8/2015).
My site was down and running update or clearing the cache would get it back up. I spent a couple of hours trying to figure out how to use drush to restore from a scheduled backup. Nothing I tried worked until I stumbled upon the post above by z3cka (#11). Following the solution in #11, I was finally able to get the restore completed by running the following drush command from the scheduled backup folder:
The restore completed and my site was up again.