Shopware scheduled tasks (cron) do not work

Hello everybody. Have question about shopware scheduled task (cron). I create ScheduledTask in my custom plugin, actived this plugin but this task not work.

I check ScheduledTask in shopware database, there exist my task with status queued. But why it not execution? And how I see in scheduled_task database table there exist 6 tasks but no one of them no execution. Maiby need some ssh command to start them all or only one task can run, or some else? I tried php bin/console scheduled-task:run but no effect. Shopware 6, I will be grateful for any advice, tips.

1 „Gefällt mir“

Hey,

my expierence so far:

scheduled-task:register

scheduled-task:run (then, I dont know why, abort the running)

then do:

messenger:consume   

After this, have a look in the scheduled tasks DB table and most important in your log file. Choose a short task interval to test if the customized task runs correctectly. Task in Database should be now set to “scheduled” - if successful. If it fails - “failed”- Log file will also provide you with further information. Still figuring out the process myself, hopefully this helped a bit further.

1 „Gefällt mir“

On the Administrationpanel by default it runs cronjobs and consume messages in asynchronous requests continously.
Try to check the Network Details on your Inspection Tool of Browser.

This feature can be disabled.

In this case it’s on you to trigger the cron jobs with: scheduled-task:run
scheduled-task:run is a programm you can give parameters for execution time else it will run till break by user.
about: messenger:consume im not allready famliar with it. It could be, that you have to execute it on console but im not sure currently.

Normaly stucking in “queued” and “failed” points out, that something goes wrong.
It’s hard to debug.

Is your Environment ENV=dev
Does it write dev.log in var/log
Could you try to treat errors with an custom log file in the Cronjob (Execution) for debugging.

I currently use an AbstractCronHandler which tries (try{]catch{}) to execute and log in a seperated custom log file.