我在 Magento 上安装了 Aoe Scheduler,并注意到“系统备份”仍在运行将近一天。我尝试使用 Aoe Scheduler 中的 kill 选项终止进程,并在我的日志文件中获取:
2015-12-22T18:33:31+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 467
2015-12-22T18:34:02+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 453
2015-12-22T18:34:02+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 453
2015-12-22T18:34:32+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 467
2015-12-22T18:34:32+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 467
2015-12-22T18:35:03+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 453
2015-12-22T18:35:03+00:00 ERR (3): Warning: posix_kill() expects parameter 2 to be long, string given in /home/angeecom/public_html/app/code/community/Aoe/Scheduler/Model/Schedule.php on line 453
Schedule.php 文件有这个:
// let's be nice first (a.k.a. "Could you please stop running now?")
if (posix_kill($this->getPid(), SIGINT)) {
$this->log(sprintf('Sending SIGINT to job "%s" (id: %s)', $this->getJobCode(), $this->getId()));
} else {
$this->log(sprintf('Error while sending SIGINT to job "%s" (id: %s)', $this->getJobCode(), $this->getId()), Zend_Log::ERR);
}
// check if process terminates within 30 seconds
$startTime = time();
while (($waitTime = (time() - $startTime) < 30) && $this->checkPid()) {
sleep(2);
}
if ($this->checkPid()) {
// What, you're still alive? OK, time to say goodbye now. You had your chance...
if (posix_kill($this->getPid(), SIGKILL)) {
$this->log(sprintf('Sending SIGKILL to job "%s" (id: %s)', $this->getJobCode(), $this->getId()));
} else {
$this->log(sprintf('Error while sending SIGKILL to job "%s" (id: %s)', $this->getJobCode(), $this->getId()), Zend_Log::ERR);
}
} else {
$this->log(sprintf('Killed job "%s" (id: %s) with SIGINT. Job terminated after %s second(s)', $this->getJobCode(), $this->getId(), $waitTime));
}
kill 不起作用,但我不明白为什么 cron 一开始还在运行!
最佳答案
也许回答有点晚,但我遇到了和你一样的问题。
经过一段时间的挫折后,我去了连接管理器并卸载了扩展,清理了所有缓存,注销并重新安装。 这对我有用,它现在运行正常。
恐怕我无法说出它有什么问题,只是它对我有用。
关于php - Cron 不会停止运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34422972/