Getting site-offline message when trying to drupal_bootstrap from command line I'm trying to bootstrap drupal from a standalone PHP script at the command line from sites/all/modules/mymodule/mymodule.php.

&lt;?php
  chdir('/sandbox/mysite/');
  require_once './includes/bootstrap.inc'; 
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


I'm attempting to run it from the command line, but I get Drupal site-offline when I do (trimmed for brevity):

cd /sandbox/mysite
php sites/all/modules/mymodule/mymodule.php

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Site off-line | Pressflow&lt;/title&gt;


The site is online and works fine from the browser. DRUPAL_BOOTSTRAP_DATABASE is where this fails, since I can bootstrap the DRUPAL_BOOTSTRAP_CONFIGURATION and DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE phases without a problem. Anyone run into this before? Thanks in advance.
An easy way of writing CLI code for Drupal is implementing your own drush (http://drupal.org/project/drush) commands. Drush itself commes wirh handy example code.