【发布时间】:2016-03-29 03:19:25
【问题描述】:
我在 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 首先仍在运行!
【问题讨论】:
-
看起来很奇怪。
SIGINT在 Aoe_Scheduler_Helper_GracefulDead (第 22 行 ish)中分配,并提供了一个方法本身来调用 - 不知道为什么它会是一个字符串......也许你需要调试SIGINT在这一点上是什么,因为它不应该t 是一个字符串 -
是的,最终完成但并没有真正解决问题的是禁用 Aoe,然后清空数据库中的 cron 计划并关闭 Magento Admin 中的数据库备份。然后我重新启用了 Aoe。
-
即你把它关了又打开了?
-
不,我重新打开了 Aoe,但现在我只是要手动备份数据库。