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.

CTA Website Security Checklist

Related Posts

The Dilemma of Estimates

The Dilemma of Estimates

Estimates serve as the cornerstone of any website project, providing clients with a roadmap for budgeting, planning, and expectation management. They offer a glimpse into the intricate tapestry of tasks, timelines, and resources needed to bring a website to life.

Config Sync Overview

Config Sync Overview

When Drupal 8 was released, it came with Configuration Syncing functionality. This has been a staple ever since for Drupal 9, Drupal 10, and beyond. Configuration Syncing was a game changer and one of my favorite features in Drupal Core.The days before config sync...