Sugar调度程序作业将无法运行

时间:2013-09-11 21:46:13

标签: sugarcrm

您好我的自定义/ Extension / modules / Schedulers / Ext / ScheduledTasks文件夹中有一个调度程序,文件名与我的函数名称相同(fetch_account_pricing_info_from_recurly)

/* make the scheduler visable in the job creator */
array_push($job_strings, 'fetch_account_pricing_info_from_recurly');


function fetch_account_pricing_info_from_recurly(){
    $GLOBALS['log']->fatal('my fatal message');

    /* select all the active accounts */
    $sql = "SELECT * FROM accounts INNER JOIN accounts_cstm ON accounts_cstm.id_c = accounts.id WHERE status_c = 'Active Customer'";
    $result = $GLOBALS['db']->query($sql);

    while($row = $GLOBALS['db']->fetchByAssoc($result)){
        /* iterate over the accounts fetching the recurly subscription info from the SugarRecurlySyncService */
        $account = BeanFactory::getBean('Accounts', $row['id']);
        try{
            $account->recurly_amount_c = 100;
            $account->recurly_valid_c = true; 
            $account->save();
        }catch(Exception $e){
        }
    }
    return true;
}

我已经快速构建和修复,以便其内容显示在modules / Schedulers / ext / ScheduledTasks / scheduledtasks.ext.php

我已经创建了一个基于此调度程序的作业,它应该从管理界面每分钟运行一次,但是当我从命令行运行cron作业时     php -f cron.php

我看到这一行与我的工作有关

Wed Sep 11 16:41:12 2013 [11966][1][DEBUG] process_full_list: Scheduler(641c28bd-44ad-0b02-f7ad-522e4e2abb93): name = Update Pricing
Wed Sep 11 16:41:12 2013 [11966][1][DEBUG] process_full_list: Scheduler(641c28bd-44ad-0b02-f7ad-522e4e2abb93): job = function::fetch_account_pricing_info_from_recurly

如果作业实际上正在运行,我认为致命日志会显示在日志文件中。那为什么不运行呢?

1 个答案:

答案 0 :(得分:1)

当我检查我的job_queue表时,我看到我有一个状态为'running'而不是'done'的条目。删除该行修复了我的问题