Magento: Find Magento cron jobs status
The cron job is a background process and there is no option to check the cron jobs status from Magento admin section.
But one might be curious to know if the crontab is properly installed and configured. And also if the jobs are running as expected in the scheduled time.
Magento stores all the jobs and statuses in cron_schedule table. So he have below options to see the jobs on Magento.
1. Magento extension that gives an interface in admin section with all the jobs & statuses
As per my notice this extension is working fine till 1.9.1.0 even the compatibility was upto 1.7
2. A PHP script to display the jobs from the above tables
This script would need database connection details to connect to Magento database
$MGROOTPATH = "/magento/root/path/"; $xml = simplexml_load_file($MGROOTPATH . 'app/etc/local.xml'); $tblprefix = $xml->global->resources->db->table_prefix; $dbhost = $xml->global->resources->default_setup->connection->host; $dbuser = $xml->global->resources->default_setup->connection->username; $dbpass = $xml->global->resources->default_setup->connection->password; $dbname = $xml->global->resources->default_setup->connection->dbname; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname);
Then display all the jobs in a tabular format from the database
echo $row['schedule_id'] . " - "; echo $row['job_code'] . " - "; echo $row['status'] . " - "; echo $row['messages'] . " - "; echo $row['created_at'] . " - "; echo $row['scheduled_at'] . " - "; echo $row['executed_at'] . " - "; echo $row['finished_at'] . "<br/>";
Additionally below is the script to see all distinct jobs running in Magento
$jobsResult = mysql_query("SELECT job_code FROM {$tblprefix}cron_schedule GROUP BY job_code") or die (mysql_error()); while ($row = mysql_fetch_array($jobsResult)) { echo $row['job_code']."<br/>"; }
That’s a smart way of thkniing about it.