AnsweredAssumed Answered

Scheduler not running

Question asked by Jagjit Singh on Aug 29, 2016
Latest reply on Sep 5, 2016 by Avinash Singh

Hi

   Scheduler is not running.

I have this Batch file

cd C:\xampp\htdocs\SugarCrm
c:\xampp\php\php-cgi.exe -c c:\xampp\php\php.ini -f cron.php 

I put alert in cron.php but is not showing

 

These are 2 other files created after Repair in these folders

C:\xampp\htdocs\SugarCrm\custom\modules\Schedulers\Ext\Language\en_us.lang.ext.php

<?php
//WARNING: The contents of this file are auto-generated

$mod_strings['LBL_MYLEADS'] = 'Leads Report';
?>

 

C:\xampp\htdocs\SugarCrm\custom\modules\Schedulers\Ext\ScheduledTasks\scheduledtasks.ext.php . In this csv is also not getting created.

 

<?php

array_push($job_strings, 'MYLEAD');

function MYLEAD() {

$leadsArray = array();
$leadsBean = BeanFactory::getBean('Leads');
$leads = $leadsBean->get_full_list('', "date_entered > SUBDATE(NOW(),2)");
if ($leads != null) {
foreach ($leads as $lead) {
$leadsArray[] = array(
$lead->name,
$lead->status,
);
}
}

$fp = fopen('/tmp/leads.csv', 'w');

foreach ($leadsArray as $fields) {
fputcsv($fp, $fields);
}

fclose($fp);


require_once('include/SugarPHPMailer.php');
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['a@gmail.com'];
$mail->FromName = $defaults['Test'];
$mail->Subject = 'Leads';
$mail->Body = 'Please find attached all leads from yesterday';
$mail->addAttachment('/tmp/leads.csv', date("Y-m-d-H-i") . "-leads.csv", Encoding::Base64, "text/csv");
$mail->prepForOutbound();
$mail->AddAddress('a@gmail.com');
@$mail->Send();
return true;

}

?>

Outcomes