Index: /trunk/gridctl.php
===================================================================
--- /trunk/gridctl.php	(revision 2)
+++ /trunk/gridctl.php	(revision 3)
@@ -19,5 +19,5 @@
 if ( ! mysql_select_db( $gDB, $gLink ) )
 {
-   write_log( "$self: Could not connect to DB $gDB" );
+   write_log( "$self: Could not select DB $gDB - " . mysql_error() );
    mail_to_admin( "fail", "Internal Error: Could not select DB $gDB" );
    exit();
@@ -412,4 +412,5 @@
 
     case 'COMPLETED'   :
+    case 'DONE'   :
       $query   = "UPDATE analysis SET status='COMPLETE' WHERE gfacID='$gfacID'";
       $message = "Job status request reports job is COMPLETE";
@@ -438,6 +439,10 @@
 
     default            :
+      // We shouldn't ever get here
       $query   = "";
       $message = "Job status was not recognized - $job_status";
+      write_log( "$self - update_job_status: " .
+                 "Job status was not recognized - $job_status\n" .
+                 "gfacID = $gfacID\n" );
       break;
 
@@ -535,4 +540,23 @@
    // Parse the result
    $gfac_status = parse_response( $xml );
+
+   // This may not seem like the best place to do this, but here we have
+   // the xml straight from GFAC
+   $status_types = array('SUBMITTED',
+                         'SUBMITED',
+                         'INITIALIZED',
+                         'PENDING',
+                         'ACTIVE',
+                         'COMPLETED',
+                         'DONE',
+                         'DATA',
+                         'CANCELED',
+                         'CANCELLED',
+                         'FAILED',
+                         'UNKNOWN');
+   if ( ! in_array( $gfac_status, $status_types ) )
+      mail_to_admin( 'debug', "gfacID: /$gfacID/\n" .
+                              "XML:    /$xml/\n"    . 
+                              "Status: /$gfac_status/\n" );
 
    return $gfac_status;
@@ -731,4 +755,5 @@
    $headers  = "From: $org_name Admin<$admin_email>"     . "\n";
    $headers .= "Cc: $org_name Admin<$admin_email>"       . "\n";
+   $headers .= "Bcc: Dan Zollars<dzollars@gmail.com>"    . "\n";     // make sure
 
    // Set the reply address
Index: /trunk/manage-us3-pipe.php
===================================================================
--- /trunk/manage-us3-pipe.php	(revision 2)
+++ /trunk/manage-us3-pipe.php	(revision 3)
@@ -43,4 +43,5 @@
    global $user;
    global $passwd;
+   global $self;
 
    $list                   = explode( ": ", $msg );
@@ -56,5 +57,5 @@
    if ( ! $resource )
    {
-      write_log( "$self process(): Could not connect to DB" );
+      write_log( "$self process(): Could not connect to MySQL - " . mysql_error() );
       write_log( "$self process(): original msg - $msg" );
       return;
