6

Is it feasible to run the Magento cron (on Linux) at a shorter interval than 5 minutes? It seems that every resource I find seems to recommend 5 minutes.

The reason is that I have an auto invoice generating module which means the customer needs to wait 5 minutes before an invoice is generated.

This is not an observer triggered code that is hooked up to an event, but it's a process handled by the internal Magento cron tab.

Has anyone had any issues with 1 or 2 minutes? Are ther performance implications?

7
  • Cron is made to run periodic tasks. What you're describing is an event, that when observed requires a an action.
    – user4351
    Commented Feb 25, 2015 at 7:28
  • @Melvyn no, it is triggered by a Magento cron tab which essentially is triggered by your OS cronjob. Commented Mar 3, 2015 at 22:26
  • Yes, that is how you have implemented it now. But, there are conditions / events that require an invoice to be generated, correct? You can generate the invoice right then and there. Of course the point is moot with 1.9.1 since mail is sent by cron.
    – user4351
    Commented Mar 4, 2015 at 9:06
  • @Melvyn your comment / question is really besides the point. But the extension that I am using is xtento.com/magento-extensions/magento-order-export-module.html and this extension supports 2 ways to export the CSV - event and cron. Commented Mar 4, 2015 at 22:11
  • @Melvyn ah, and more importantly I have running an auto-invoice generator that relies on a cron too. So event vs cron is out of the question here... Commented Mar 4, 2015 at 22:13

2 Answers 2

8

You can setup a cronjob for whatever interval you want. As far as Magento is concerned, it does not care. Having said that, there are a few things to consider:

  • Your host might restrict cronjob intervals
  • If a process that runs on the Magento cron takes too long to complete before the next cron is started they can start to stack up and add load to the server

Again, Magento doesn't care. You can try making it 1 minute. I would suggest using the SSH command ps aux | grep cron.php (or cron.sh). This will help you to see how many instances of the cron.php are being run. If you see that start to grow and grow you need to dial back the interval. Also be aware that the command above could also show other cron jobs running on the server. Be sure those you identify belong to Magento.

2
  • There SHALL only be one cron.php running! This is why cron.sh exists. The stuff we fix related to people thinking they can run parallel is quite substantial and ranges from corrupted indexes to flags being set on carts that shouldn't be.
    – user4351
    Commented Mar 4, 2015 at 9:10
  • I should have probably added that when possible it's always preferred to use cron.sh over cron.php to avoid the multiple instances running like Melvyn mentioned.
    – Winston
    Commented Mar 4, 2015 at 18:15
0

You can run another cron task and have it execute from the shell. However, as someone has stated, what you require is actually an event and is better served as that. Otherwise you are going to be running a cron job that does nothing effective 99% of the time and will drain resources from your site when you need it most - when the customer is there

1
  • It is not an observer that is triggered by an event, it is a process handled by a Magento cron tab which is triggered by the OS cronjob. Commented Mar 3, 2015 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.