Magento handles cron through a single cron.php file
Running this is documented by Magento.
crontab -eto create or edit the the crontab, the user creating the crontab is correct.
*/5 * * * * /bin/sh /[your Magento install dir]/cron.shto run cron every 5 minutes, debug crontab here.
Magento cron gotchas¶
- Magento does prevent duplicate runs, but only silently. This means it won't sanity check a task that's been running for an inordinately long time
- It's not able to be paralled, so legitimately long-running tasks will hold up any other tasks
Using Edmonds Commerce's Cron Runner with Magento¶
The EC Cron Runner could be used to run tasks outside of Magento.
To do this, remove from the module's config.xml the cron task in question. Keep a note of the
Then create a file resembling an example within Magento's shell/ folder. Something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Once this is in place, add it as a new task as documented in the cron runner docs.
How to debug Mangeto 1 Cron¶
- Check that the Magento cron is present in
- Check the magento default logs in
- Check the cron task log (assuming there is one)
- You can sort the log files using
magerun sys:cron:listto list all the scheduled corn jobs
magerun sys:cron:historyto see what jobs ran/are running
- You can use
ps aux | grep cronto see if the cron process is running
- In case you need to terminate the process use
- As a last resort, the process can be killed using
kill -9 <process_pid>
- Cron jobs can be run manually using
magerun sys:cron:run <cron_job_name>