Test CRON

From time to time, we might want to test Magento's CRON.

An easy way to test if it does run well is by appending the following to your cron.php file:
try{
   $myFile ="cronlog.txt";
   $fh = fopen($myFile,'w');
   $stringData = date('l jS \of F Y h:i:s A');
   fwrite($fh, $stringData);
   fclose($fh);}catch(Exception $e){Mage::printException($e);}

This snippet will create a cronlog.txt file (if the file doesn't exist) and append the date/time of your cron runs.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Clearing cache from the shell

Magento often needs to refresh it's cache. In some occasion, you may want to flush either...

Magento Best Practices

Magento can be very tricky.  And sometimes, it is getting quite confusing on how to properly...

How to add and edit product ratings and reviews in Magento

In Magento each product can be rated and reviewed. Customers (both guests and registered ones)...

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2828-148-1-471' for key 'PRIMARY'

While trying to reindex your store using the command line, you stumble on the following...

Why is Magento cron job not working?

cPanel + CageFS and CloudLinux's PHP switcher may cause problems with Magento CRON. Until this is...