0

I tried to create custom cron job and it's all works, but how can I turn it off so it will not run again.

I already tried to comment (//) the cron job in crontab.xml but it's not working.

4
  • Did you use // in an xml file instead of <!-- --> ?
    – BAF
    Dec 12, 2017 at 10:41
  • ah yes i mean <!-- --> Dec 12, 2017 at 10:42
  • OK - here is a post that may help magento.stackexchange.com/questions/62066/…
    – BAF
    Dec 12, 2017 at 10:44
  • it's related to magento 1 but the bit about having a toggle is a good idea. this would be set in the code that is executed by the cron. Otherwise someone else can perhaps assist in resetting the cron.
    – BAF
    Dec 12, 2017 at 10:51

1 Answer 1

1

Just clear the cache and to prevent already scheduled tasks, clear the cron_schedule table (or specifically remove all rows with the tag of your custom cron job.)

2
  • So removing all rows with my custom cron job tag will stop the cron from scheduling? Dec 13, 2017 at 2:22
  • @EdwinWidhiyanto No, removing the tasks from the cron_scehedule prevents tasks that are already sceduled from being executed. Commenting out the job in the crontab.xml and clearing the cache should prevent it from being added to the cron_schedule again. Dec 13, 2017 at 8:11

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.