Help Docs Control Panel Guides Nexcess Control Panel Nexcess Managed Magento Nexcess Managed Magento Store Management Finding the status of Magento cron jobs / tasks

Finding the status of Magento cron jobs / tasks

Learn how to simplify identifying your cron job tasks in this article.

As covered in our last article, there is a “cron job” (crontab) set up to run Magento’s cron.php file every so often (15 minutes or so is fine) via PHP directly on the server to take care of housekeeping tasks that keep Magento working well. Some other tasks, like updating tracking / inventory status, sending out newsletters, and other miscellaneous things also require that the crontab be properly set up, so if you haven’t taken care of that yet, please see the setup guide. Once your crontab is properly installed and configured, you might be curious as to what it’s actually doing behind the scenes, or you might want to verify that something did / did not happen, and when.

Since Magento lacks this arguably critical information, we’ve whipped up a simple PHP script that can show you what’s scheduled, what’s running, and what already ran, along with all the other information hiding in the ‘cron_schedule’ table of your Magento database. Simply drop the script (linked to below) into your base HTML directory for Magento (usually this will be your “public_html” directory), change the file extension to “.php” instead of “.phps”, and load it up in your favorite browser.
You should see something like this:
Mage Cron
All of the fields should speak for themselves.
Copy and save the following PHP script.

[code language="php"]
<!--?php &lt;br ?--> // Parse magento's local.xml to get db info, if local.xml is found
if (file_exists('app/etc/local.xml')) {
$xml = simplexml_load_file('app/etc/local.xml');
$tblprefix = $xml-&gt;global-&gt;resources-&gt;db-&gt;table_prefix;
$dbhost = $xml-&gt;global-&gt;resources-&gt;default_setup-&gt;connection-&gt;host;
$dbuser = $xml-&gt;global-&gt;resources-&gt;default_setup-&gt;connection-&gt;username;
$dbpass = $xml-&gt;global-&gt;resources-&gt;default_setup-&gt;connection-&gt;password;
$dbname = $xml-&gt;global-&gt;resources-&gt;default_setup-&gt;connection-&gt;dbname;
}
else {
exit('Failed to open app/etc/local.xml');
}
// DB Interaction
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to <a class="HelpLink">mysql</a>');
mysql_select_db($dbname);
$result = mysql_query("SELECT * FROM " . $tblprefix . "cron_schedule") or die (mysql_error());
// CSS for NexStyle
echo '

&lt;title=Magento Cron <span style="'background-color: #CCFF00;">Status</span>&gt;

<style type="text/css">
 html {<br />
  width: 100%;<br />
  font-family: Helvetica, Arial, sans-serif;<br />
 }<br />
 body {<br />
  background-color:#00AEEF;<br />
  color:#FFFFFF;<br />
  line-height:1.0em;<br />
  font-size: 125%;<br />
 }<br />
 b {<br />
  color: #FFFFFF;<br />
 }<br />
 table{<br />
  border-spacing: 1px;<br />
  border-collapse: collapse;<br />
  width: 300px;<br />
 }<br />
 th {<br />
  text-align: center;<br />
  font-size: 125%;<br />
  font-weight: bold;<br />
  padding: 5px;<br />
  border: 2px solid #FFFFFF;<br />
  background: #00AEEF;<br />
  color: #FFFFFF;<br />
 }<br />
 td {<br />
  text-align: left;<br />
  padding: 4px;<br />
  border: 2px solid #FFFFFF;<br />
  color: #FFFFFF;<br />
  background: #666;<br />
 }<br />
 </style>

';
// DB info for user to see
echo '

<a href="https://nexcess.net">
<img src="https://www.liquidweb.com/wp-content/uploads/2025/12/logoMainR2.gif" alt="Nexcess Beyond Hosting" width="217" height="38" /></a>
<b>Table Prefix:</b> ' . $tblprefix . "
. '<b>DB Host:</b> ' . $dbhost . "
. '<b>DB User:</b> ' . $dbuser . "
. '<b>DB Name</b>: ' . $dbname . '

';
// Set up <span style="background-color: #ccff00;">the</span> table
echo "

";// Display the data from the querywhile ($row = mysql_fetch_array($result)) {echo "";echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
}
// Close table and last few tags
echo "
<table border="'1′">
<tbody>
<tr>
<th>schedule_id</th>
<th>job_code</th>
<th><span style="background-color: #ccff00;">status</span></th>
<th>messages</th>
<th>created_at</th>
<th>scheduled_at</th>
<th>executed_at</th>
<th>finished_at</th>
</tr>
</tbody>
<tbody>
<tr>
<td>" . $row['schedule_id'] . "</td>
<td>" . $row['job_code'] . "</td>
<td>" . $row['<span style="background-color: #ccff00;">status</span>'] . "</td>
<td>" . $row['messages'] . "</td>
<td>" . $row['created_at'] . "</td>
<td>" . $row['scheduled_at'] . "</td>
<td>" . $row['executed_at'] . "</td>
<td>" . $row['finished_at'] . "</td>
</tr>
</tbody>
</table>
";
mysql_close($conn);
?&gt;
[/code]
Note:
This script is designed to be secured for use by site administrators only.

Was this article helpful?