Usually I’ve been asked about how to run a cron task manually. A cron task defined in Magento is not anything else than a function that belongs to a model that is loaded and executed.
For example, we have this cron task on a config.xml file of a specific module:
<catgento_sap_sync_nonimages> <schedule> <cron_expr>*/15 * * * *</cron_expr> </schedule> <run> <model>sap/cron_sync_nonimages::run</model> </run> </catgento_sap_sync_nonimages>
It’s easy to identify the model and function that is being loaded and executed as it is inside the <model> tags. The model that is being loaded is sap/cron_sync_nonimage, and the function inside that model that is being executed is run.
Knowing this, we can create a new script that loads and executes that cron task like this (create a script.php file and put something like this inside):
<?php //Load Magento API require_once 'app/Mage.php'; Mage::app(); //First we load the model $model = Mage::getModel('sap/cron_sync_nonimage'); //Then execute the task $model->run();
The last step would be running this script manually (php script.php).