我写了一个 Cron 作业来杀死休眠时间过长的进程。但是,当我终止一个进程时,它会立即重新生成。是什么重新启动了这些进程?它是MySQL设置吗?
这是我正在使用的代码:
db.driver.execQuery 'select * from information_schema.processlist where time > 2000', (err, threads) ->
if err? then return
if !threads? then return
for thread in threads
do (thread) ->
db.driver.execQuery 'kill ' + thread.ID, (err, response) ->
console.log 'Killed thread that was ' + thread.TIME + ' seconds old'