Advertisement
mybeshoo

Untitled

Jul 15th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <?php
  2.  
  3. include_once (dirname(__file__) . '/../includes/config.php');
  4. do
  5. {
  6. $toKill = $db->query('select id,md5id,pid,mysqlid from accounts where next_action_run=1 and last_proc_time < DATE_SUB(NOW(), INTERVAL 20 MINUTE) and activity_status = 1');
  7. foreach ($toKill as $key => $val)
  8. {
  9. //if ($val['pid'])
  10. //{
  11.  
  12. $db->param_char = '##';
  13. $db->query("update accounts set pid = NULL,killed = 1,next_action_run=0,next_action=DATE_SUB(DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), INTERVAL 5 MINUTE) ,last_proc_time=now() where id =" . $val['id']);
  14. $db->param_char = '%';
  15. // print $val['pid'] . ':' . $val['md5id'] ." Killed by killsleep ". date_time('full') ."\n";
  16. print date_time('full') . '|'. $val['md5id'] . '|' . $val['mysqlid']. '|' .$val['pid'].PHP_EOL;
  17. if ($val['pid'])
  18. {
  19. exec('mysql --user="root" --password="*******PASS************" --execute="kill '.$val['mysqlid'].';" > /dev/null 2>&1');
  20. exec('kill -9 ' . $val['pid'] . ' > /dev/null 2>&1');
  21. }
  22. }
  23. sleep(60);
  24. } while (true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement