Hi I've got a scheduler in my custom/Extension/modules/Schedulers/Ext/ScheduledTasks folder with a file name that's the same as my function name (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;
}
I've done a quick build and repair so that its contents show up in modules/Schedulers/ext/ScheduledTasks/scheduledtasks.ext.php
I've created a job based on this scheduler that is supposed to run every minute from the admin interface, but when I run the cron jobs from the command line php -f cron.php
I see this line related to my job
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
If the job were actually running though I'd think that the fatal log would show up in the log file. So why isn't it running?
When I checked my job_queue table I saw that i had an entry with a status of 'running' instead of 'done'. Deleting that row fixed my problem