]> andersk Git - sql-web.git/blobdiff - cron/checkProcesses.php
signup: lower minimum UIDs
[sql-web.git] / cron / checkProcesses.php
index a33e9694adf1418f8b38d92350dcd95a303124d6..d927e58c1d3f5d54ad75e93493b2b86cf6c825d6 100755 (executable)
@@ -5,7 +5,7 @@ require_once('mitsql.cfg.php');
 require_once('mitsql.lib.php');
 isOffline() && exit;
 
-define('MAX_PROC_TIME', 10);
+define('MAX_PROC_TIME', 30);
 
 $baddbs = $badusers = $bad = array();
 $result = mysql_query('SHOW FULL PROCESSLIST');
@@ -18,12 +18,13 @@ while ($row = mysql_fetch_assoc($result)){
 }
 mysql_free_result($result);
 
+print_r($bad);
 foreach($bad as $badproc) {
        $mailtos = $mailnames = array();
        $baddb = mysql_escape_string($badproc['db']);
+       if (empty($baddb)) continue;
        $badtime = $badproc['Time'];
        $badquery = $badproc['Info'];
-       if (empty($baddb)) continue;
        $sql = "SELECT User.UserId,User.Name,User.Email
                        FROM `User`
                        NATURAL JOIN DBOwner
@@ -35,10 +36,13 @@ foreach($bad as $badproc) {
                $mailtos[] = $addy['Email'];
                $mailnames[] = $addy['Name'];
        }
-       if (empty($mailtos)) continue;
+       if (empty($mailtos)) {
+               echo "No email found for $baddb\n";
+               continue;
+       }
        $mailto = implode(', ',$mailtos);
        $mailname = implode(', ',$mailnames);
-       $mailsubj = "[sql] Slow Query on $baddb";
+       $mailsubj = "[sql.mit.edu] Slow Query on $baddb";
        $mailbody = "Dear $mailname:
 
 A slow query was found on your database: $baddb
@@ -49,7 +53,9 @@ been appended to this message for your records. Please optimize your
 queries to avoid having your queries killed in the future. If you have any
 questions, please contact sql@mit.edu.
 
-This SQL Service is available at sql.mit.edu.
+The SQL Service
+Email: <sql@mit.edu>
+Web: http://sql.mit.edu/
 
 ---------------------------------------------------------------------------
 
This page took 0.026621 seconds and 4 git commands to generate.