Commit 876a3b84 authored by zw's avatar zw

log

parent 99936998
...@@ -13,12 +13,14 @@ use think\console\command\make\Model; ...@@ -13,12 +13,14 @@ use think\console\command\make\Model;
class KillOutTimeSql{ class KillOutTimeSql{
public function killOutTimeSql(){ public function killOutTimeSql(){
$model = new ASite(); $model = new ASite();
$sql = "select concat('KILL ',id,';') from information_schema.processlist where user='tl_root' and time > 20 and db='db_tongliandichan' or db is null"; $sql = "select concat('KILL ',id,';') as kill_sql,info from information_schema.processlist where user='tl_root' and time > 20 and db='db_tongliandichan' or db is null";
//$sql = "select concat('KILL ',id,';') as kill_sql from information_schema.processlist where user='tldc_online' and time > 20 and db='db_tongliandichan' or db is null"; //$sql = "select concat('KILL ',id,';') as kill_sql from information_schema.processlist where user='tldc_online' and time > 20 and db='db_tongliandichan' or db is null";
$result = $model->query($sql); $result = $model->query($sql);
if($result){ if($result){
foreach ($result as $item){ foreach ($result as $item){
$kill_sql = $item["kill_sql"]; $kill_sql = $item["kill_sql"];
$log = "out_time_sql :" .$item["info"];
big_log($log);
$model->query($kill_sql); $model->query($kill_sql);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment