php - Cron 不会停止运行

标签 php magento cron

我在 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/

相关文章:

php - Azure 上的自定义 PHP 扩展

php - 为什么我的 symfony 实体不受管理?

php - Magento 最小订购量 api

php - 加载 Magento 页面时出现奇怪的错误

linux - Cron 守护进程正在运行并且系统日志守护进程正在运行但 cron 不会运行

php - 在 PHP 中选择用户名和密码正确的条目比仅选择用户名和检查密码的优势是什么?

php - 非静态方法......不应该被静态调用

ajax - 使用 VarienForm 函数验证 Magento 注册表单获取响应

python - 定时任务错误: Windows can not find the specified file

php - 安全的 php 脚本执行