diff --git a/uc_ssl.module b/uc_ssl.module
index a1c07b2..051c37f 100644
--- a/uc_ssl.module
+++ b/uc_ssl.module
@@ -35,11 +35,16 @@ function uc_ssl_page_is_in_https_mode()
    return FALSE;
 }
 
+function uc_ssl_drupal_is_cli() {
+  return ((!isset($_SERVER['SERVER_SOFTWARE']) || $_SERVER['SERVER_SOFTWARE'] == 'PHP CLI')
+    && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
+}
+
 function uc_ssl_init()
 {
    //menu_rebuild();
    //First and foremost, make sure Clean URLs are on.
-   if (uc_ssl_clean_urls_enabled())
+   if (uc_ssl_clean_urls_enabled() && !uc_ssl_drupal_is_cli())
    {
       //Setup a hook for ssl checking
       uc_ssl_check();
