Drush Tips & Tricks & Hacks - Share your experiences and usages..

Events happening in the community are now at Drupal community events on www.drupal.org.
patoshi's picture

hi, i guess im still a beginner in drush as i dont really use all the commands. i haven't gotten to use devel yet as i dont see the usefulness of it yet.

but as for drush, ill share my experience with how i use it. i have a multi-site drupal code base and drush is a lifesaver having to enable, disable, and updatedb for each site. im maintaining about 5 sites now and all i use drush for is just enabling and disabling modules mainly.

Is there something else i might be missing that everyone uses frequently? like deleting users or nodes or what not?

the only problem right now is that i cant do an drush update since it messes everything up. I do have SVN acquia installed so im guessing that is why. another major pain is everytime i install new modules or cvs update them i have to goto each site and do a updatedb. is there a script that i can copy that can run all this for me?

The only commands i really use is:
drush --uri=http://domain.com enable
drush --uri=http://domain.com disable
drush --uri=http://domain.com uninstall
drush --uri=http://domain.com statusmodules | ack enabled (To show all enabled modules only.)
drush --uri=http://domain.com updatedb
drush --uri=http://domain.com clearcache

yea so how does everyone else use drush?

thanks!

Comments

You may create a bash script

rubenvarela's picture

You may create a bash script and use that to combine multiple instructions.

I'm on Linux and I use a bash script to backup a multi-site install I have.

Basically what the script does is put the site offline, backup the database of site1, archive the sites folder {sites/site1} with the exported database, puts the site online again. It does this for every website under /site, afterwards, using scp it, copies everything to a backup computer and then deletes the files on the server which where just copied.

I run it using a cron job

Interesting. I was wondering,

grantkruger's picture

Interesting. I was wondering, why use Drush for this, as opposed to straight up line commands? I'm assuming there is some benefit I'm missing. Maybe just the ability to avoid hard-coding a password into a script?

Also, much of this can be done using the backup_migrate module, and I see (http://groups.drupal.org/drush/commands) that drush plays nice with this module. Anyone use this?

I'll also second the call for many more examples and toss in a request for more documentation. More examples and documentation explaining things like the above would certainly help people to adapt this powerful tool.

Sala kahle,
Grant

Did you see that cheatsheet

artusamak's picture

Did you see that cheatsheet on the documentation page of Drush?

http://drupal.org/files/drush-cheat-sheet.pdf

Might be usefull for you!

==[EDIT]==
You also have that link: http://groups.drupal.org/drush/commands
(via @Julien Dubreuil http://twitter.com/juliendubreuil/statuses/6298597819)

thanks.. great tips. the

patoshi's picture

thanks.. great tips. the cheat sheet should have some examples of how the commands are used as it still seems a bit confusing just reading the parameters.

is there a way to delete users or nodes or group of nodes via drush?

Useful combination

gfdickinson's picture

Yes, you can write a custom php script and execute it with 'drush script'. In your php script you will have access to the entire drupal api.

George Dickinson
Software Engineer/Architect
5501 Patterson Ave
Suite 201
Richmond, VA 23220
804.631.3474

pelagicsoftware.com

thanks. yeah i understand

patoshi's picture

thanks. yeah i understand that, but is there a sample code where i can copy and modify. I have no idea how to start.

Drush 3.x uses shorter commands

Chris Charlton's picture

This article points out how the new Drush 3.x allows shorter commands for common commands. http://developmentseed.org/blog/2010/mar/10/drush-30-more-powerful-flexi...

For example (quoted from the blog post):

drush --root=/path/to/drupal --uri=dev.mysite.com status

While the above example will still work, you now have the option to do the following:

drush /path/to/drupal#dev.mysite.com status

You can also now do commands that weren't possible before, like:

drush username@server.com/path/to/drupal#mysite.com status

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

DevSeed link doesn't work

kbell's picture

I don't know if this post has been taken down or what, but the link in the above posts to the drush blog post goes to a 404 on DevSeed site.

--Kelly Bell
Gotham City Drupal
twitter: @kbell | @gothamdrupal
http://drupal.org/user/293443

drush

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: