Performing DRD actions from Drush

Submitted by Jürgen Haas on Mon, 08/11/2014 - 10:33

Remote Dashboard (DRD) fully supports and it does this in two ways: DRD provides all its actions as Drush commands and DRD can trigger the execution of Drush commands on remote domains. This blog post is part of a series (see part 1 of 4) that describes all the possibilities around these two powerful tools. This is part 2 which describes on how to trigger any of DRD's actions from the command line by utilizing .

Why is this useful? A lot of admins and devops are keyboard junkies and they kind of hate the idea to monitor and manage their server farm by clicking around in DRD's . All of DRD's power is now back to the terminal and extending on that idea, this helps to automate all of DRD's action by using in crontabs, e.g. to check for updates on all domains on all Drupal cores in an entire network.

Prerequisites

If DRD (version 2.4 or later) is installed and configured on your main core which is monitoring all your other Drupal cores, then you only need on that same host and access to the console. That's all you need to get access to all the nice stuff described below.

Get a list of DRD's commands

 help --filter=drd
All commands in drd: (drd)
  drd-action (drda):        Trigger a DRD action.
  drd-list-actions (drdla): List all the available actions for your DRD network.
  drd-list-cores (drdlc):   List all cores in your DRD network.
  drd-list-domains (drdld): List all domains for all or some DRD cores.
  drd-list-tags (drdlt):    List all the available tags in your DRD network.

Global options

The following options are available for DRD's commands

General options:
 --filter-cores            Filter the list by core id(s) they belong to                     
 --filter--versions  Filter the list by the drupal version of the core                
 --filter-              Filter the list by the ssl-usage of the domain: yes=1|no=0       
 --filter-status           Filter the list by the status of the domain: active=1|disabled=0 
 --filter-tags             Filter the list by tags of the core

Additional domain options:
 --filter-domains          Filter the list by domain id(s) they belong to                   
 --filter-errors           Filter the list by the error status                              
 --filter-installed        Filter the list by the installation status                       
 --filter-warnings         Filter the list by the warnings status

Additional option for triggering an action:
 --ask                     Prompt the user to select the core and/or domain to work on

Options for action list:
 --mode                    Limit the actions to be listed by their mode: defaults to all but can be either any|server|domain

Options for tag list:
 --mode                    Limit the tags to be listed by their mode: defaults to all but can be either server or domain

DRD actions supported by core: use drd-list-actions to get a list of all actions provided by your system.

Main command drd-action

To trigger any of the actions that are also available from the DRD just use the drd-action command. Here are a couple of examples:

Check for project updates on all domains:

 drd-action drd.list.updates

Check for project updates on all domains that run version 7.28:

 drd-action drd.list.updates --filter--version=7.28

Enable maintenance mode on all domains:

 drd-action drd.switch.maintenance --maintenancemode=1

Select an action from a list of all available actions, just don't provide any action to trigger:

 drd-action

Getting more help

Global options are described above and some of DRD's actions come with additional options or parameters. To find out about these, there is a special usage for drd-action that takes help:[action-name] as its sole parameter. Example:

Get help on the action drd.switch.maintenance:

 drd-action help:drd.switch.maintenance

Filtering cores and domains

With the filter options described above each of the actions can be limited to just some of the domains that are managed by DRD. If no filter is provided then each given action is triggered on all available domains.

Another way of limiting an action to just one or a few domains you can use the --ask option. This will provide you with a list of all cores or domains and you can select on which of those you want to trigger the action.

Tips & Tricks

Interested in a few powerful usage examples of DRD via ? We are providing some of them in the below list and extend that list over time if we come across other ones.

Get a list of available actions, select one and then select cores or domains on which to trigger that action:

 drd-action --ask

Check for new domains on all enabled cores every night at 2am, configure crontab with the following line:

Check for updates on all enabled domains every night at 3am, configure crontab with the following line:

Have you found another one you would like to share with the community? Please leave a comment and we'll be happy to add yours to this list.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.