2

I'm trying to define a cronjob for a custom module, but having a hard time going through the proper flow of scheduled cronjobs.

Few things of note:

  • It seems that third-party cronjobs are only scheduled once, when the cache is flushed. When the scheduled ./bin/magento cron:run runs every minute, the first time the cache is flushed it picks up all of the third-party module cronjobs, and runs them on the next execution.
  • After the first run, it doesn't seem as though these third-party modules are scheduled for a second run, ever. Until the cache is flushed again.
    • Is this perhaps related to cron group? I noticed that items in the default cron group never get rescheduled, but it seems that items in the index cron group do (at least items from core code).
    • Disabling the cache doesn't help.
    • Even if cache is disabled, the third-party modules never get registered.
    • Even if cache is disabled, iff a ./bin/magento cache:flush is run, all of the items in the default group do get scheduled. This leads me to believe that either that cache is not getting properly disabled, there is a bug in the caching system, and/or there is some sort of intricacy with how the cache actually works.
  • What is the purpose of running php update/cron.php if we are already running ./bin/magento cron:run, and what is the difference between the two? I'm pulling info from devdocs http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html#config-cli-cron-bkg
  • This looks like issue, can you create this on github? – KAndy Dec 10 '15 at 14:58
  • Sure, I'll create one. Thanks, just needed another set of eyes on this to make sure I'm taking the right steps. – Mark Shust Dec 10 '15 at 15:36
  • Posted to github.com/magento/magento2/issues/2672 – Mark Shust Dec 10 '15 at 15:38
0

{partial answer}

update/cron.php is required for managing various components and system upgrade. A separate cron is required so that these actions can be performed from outside the Magento application, since such actions may cause an invalid state, such as incomplete updates and rollbacks.

http://devdocs.magento.com/guides/v2.0/comp-mgr/prereq/prereq_compman-updater.html

  • 1
    The link posted only defines */1 * * * * php <your Magento install dir>/update/cron.php & */1 * * * * php <your Magento install dir>/bin/magento setup:cron:run & there is no mention of ./bin/magento cron:run. Is this also a bug? – Mark Shust Dec 10 '15 at 15:41
  • The link refers to the crons that are ONLY related to "component manager and system upgrade". So that is not a bug. – Maddy Dec 10 '15 at 16:37

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.