Using Drush to Check Site Status

Share this post

We recently discussed how you can use Drush to maintain modules on your site. You can also use Drush to learn important configuration information, or discover errors that have been logged, without ever having to sign in to the admin side of a site.  Here are a few commands you can type to gain information about the site you are currently working on.

drush @alias status

In the above command, @alias is not needed, but why not take advantage of the aliases we set up earlier? Without the @alias Drush will attempt to guess what site you are working on. If the site is a Drupal multi-site, you will have to make your current working directory the multi-site you desire. If nothing is given it will default to ‘default’. The status command will provide information about your Drupal installation, and some Drush configuration information as well.

Instead of logging into the admin side of a site to check the status report, save yourself a few steps by running the check from the command line.

drush rq

The command line also allows for easy manipulation of data to get exactly the information you are looking for. This is a handy tool when you need to check the overall configuration status of a site. A lot of information is released, helping to determine what, if any, work needs to be done.

Drupal keeps a log called ‘Watchdog’ in order to track everything happening on a site. This log can contain some critical information. And, yes, this can also be accessed via Drush.

drush ws

By default this will display the last 10 messages logged, but like all the other commands there is a bank of arguments and flags available to tailor the output to exactly what is needed. Keep in mind the database logging modules must be enabled in order for Watchdog to record events.

Although there are nice tools that help expedite certain tasks, sometimes you still need to log in in to the admin side. This could be as easy as adding /user to the address bar. However, if you are a web developer with many clients, it makes more sense to use the command the nice guys who made Drush wrote:

drush uli

This prints a link that can be used to log in as the admin user as a one-time authentication. If you are working locally, this will even open a browser to the specified URL.

The beauty of Drush is that many of these commands can be used with the Site Aliases that we created. That way without ever having to change a directory, you can check up on, and maintain all of your clients.

Next time I will go over ways to automate the syncing of environments using Drush.

Insights

600+ articles to give you key insights for your projects