2

If my main crontab runs the magento cron.php every 30 mins and i have a cron job set in a modules config.xml to run every 15 mins. Will that mean the modules cron gets run:

  1. Once every 30 mins
  2. Twice every 30 mins
  • I think that you will find that some ISP's will halt cron that run more frequently than 30 minutes. Siteground in particular d. – Richard Sep 24 '13 at 13:40
  • The nice thing about Magento cron is that you can call it through a URL. If this is the case just set up a cron on another server like so */5 * * * * wget http://domain.com/cron.php 2> /dev/null or setup it up from any Windows PC – Sander Mangel Sep 24 '13 at 13:42
  • Be careful with the cron.php - it runs asynchronously; there may be some cron processes from 3rd party vendors that depend on running to completion before issuing another call. Think cart abandonment reminders.... – philwinkle Sep 24 '13 at 14:43
  • And his service provider may have him restricted to cron every 30 minutes. Ours is rather high end and they demand a minimum of 15 min. – Fiasco Labs Sep 24 '13 at 15:55
2

There are a swath of configuration options for cron in the Magento admin under System Configuration -> System -> Cron. The one titled "Missed if Not Run Within" is, by default, set to 15 minutes and will affect what you're trying to determine. With this set at it's default of 15 minutes…

…the job scheduled for every 15 with crontab executing every 30 would (theoretically) be run only once per 30 minutes with the job scheduled for the 15 minute mark being marked as missed. However, this cannot be relied on, as the timing of the cron cycle being off by a few seconds could land it occasionally within the 15 minute period and run it twice in one cycle. So don't rely on it only running once every 30 minutes.

My suggestion would be to set the crontab to run every 5 minutes, then control the jobs actual scheduling using the AOE Scheduler module... which I've heard so much about, but haven't yet used it much myself. :)

| improve this answer | |
0

I would say once.

But dont understand why you run cron.php only every 30 min instead of every min.

| improve this answer | |
0

Checkout out the Aoe Scheduler extension. It gives you a great overview of the running crons.

Magento should run all cronjobs that are scheduled to run AFTER the last run so it should execute the cron twice every 30 minutes. If you check out the class Mage_Cron_Model_Observer the jobs are retrieved as an collection in the method getPendingSchedules. You can see that it only filters on status pending and since two jobs were added during the 30 minutes with that status it will execute them .

I'd advice you to run the cron every 5 minuten just to ensure Magento and the 3th party extensions using cronjobs runs properly

| improve this answer | |
  • but how can magento delay them or does it run both directly after each other every 30 mins and not once every 15 mins? – Marty Wallace Sep 24 '13 at 13:20
  • the cronjobs from the the extensions are stored in the table cron_schedule. Only when you call cron.php or cron.sh by your Linux cronjob that you run every 30 minutes that table is processed and the jobs are executed. So every 30 minutes it'll iterate trough all jobs in the table and run those jobs. – Sander Mangel Sep 24 '13 at 13:25
  • It runs both when the 30 minute trigger event occurs. So if you're calling cron.sh/cron.php every 30min and you have a job that schedules every 15, it will schedule two jobs that supposedly run 15 minutes apart which will both run on the next 30 minute trigger. It's annoying, just got through with an abandoned cart remailer scheduled for 5 min intervals on a 15 minute trigger. It was blasting out three emails for each abandoned cart every 15 minutes. Changed the abandoned cart remail to 15 minute intervals and the customer now gets a single email per abandoned cart. The AOE Sched helped see it – Fiasco Labs Sep 24 '13 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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