【问题标题】:Cron won't stop runningCron 不会停止运行
【发布时间】: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,但现在我只是要手动备份数据库。

标签: php magento cron


【解决方案1】:

也许回答有点晚了,但我遇到了和你一样的问题。

经过一段时间的挫折后,我去了 Connect Manager 并卸载了扩展程序,清理了所有缓存,注销并重新安装它。 这对我有用,它现在运行正常。

恐怕我不知道它出了什么问题,只是这对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-06
    • 2021-03-24
    • 2022-10-08
    • 1970-01-01
    相关资源
    最近更新 更多