# How to execute a specific scheduled task in shopware 6?

**URL:** https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771
**Category:** Programming (EN)
**Created:** [2. Januar 2020 um 10:43 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771 "2020-01-02T10:43:13Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)
#### Post date: [2. Januar 2020 um 10:43 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/1 "2020-01-02T10:43:13Z")

</div>

I want to execute a specific scheduled task. how to do it in shopware 6?

---

<div class="post-metadata">

### Author: ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)
#### Post date: [2. Januar 2020 um 11:11 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/2 "2020-01-02T11:11:03Z")

</div>

You may have a look at&nbsp;[Setting up a scheduled task&nbsp;](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/scheduled-tasks)

---

<div class="post-metadata">

### Author: ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)
#### Post date: [2. Januar 2020 um 11:51 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/3 "2020-01-02T11:51:15Z")

</div>

> [@Shopwareianer schrieb:](https://forum.shopware.com/profile/15489/Shopwareianer "Shopwareianer")
> 
> You may have a look at&nbsp;[Setting up a scheduled task&nbsp;](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/scheduled-tasks)
> 
> &nbsp;
> 
> &nbsp;
> 
> 1. I am using this command to run the task
> 
> php bin/console scheduled-task:run
> 
> I want to execute only my task
> 
> like &nbsp;
> 
> php bin/console scheduled-task:delete\_newsletter\_recipient\_task:run
> 
> How to do that?
> 
> 1. I have executed the command &nbsp;
> 
> &nbsp; &nbsp;php bin/console scheduled-task:run
> 
> &nbsp; I have added some print\_r() in my task. I want to see the print\_r() when the task executed.
> 
> &nbsp; but it is not showing the data. I have tried this command&nbsp;
> 
> &nbsp; php bin/console messenger:consume
> 
> &nbsp; How to execute and debug my scheduled task?

---

<div class="post-metadata">

### Author: ![wnboes](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@wnboes](https://forum.shopware.com/u/wnboes)
#### Post date: [28. April 2020 um 07:55 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/4 "2020-04-28T07:55:17Z")

</div>

I am also interested in testing the execution of a scheduled task for development purposes. Something like:

```
# This does not work - do not copy ;)
php src/bin/console scheduled-task:run --name shopware.sitemap_generate 

```

&nbsp;

---

<div class="post-metadata">

### Author: ![littleAmused](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/littleamused/32/13261_2.png) [@littleAmused](https://forum.shopware.com/u/littleAmused)
#### Post date: [27. August 2021 um 13:55 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/5 "2021-08-27T13:55:49Z")

</div>

Hello, I would like to join in on this topic! Is there a possibility to execute only single tasks? Have you found a solution?

And if a task does not run, but is simply marked as „failed“ in the database - what is the best way to debug this? I have not found an error log anywhere.

Best regards, LA

---

<div class="post-metadata">

### Author: ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)
#### Post date: [27. August 2021 um 15:27 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/6 "2021-08-27T15:27:10Z")

</div>

You can check this table for ‚dead\_message‘ for error messages

Or use the following plugin

> **[Scheduled Task Manager](https://store.shopware.com/en/ods4177677942163/scheduled-task-manager.html)**
>
> In Shopware5 you had an overview of the cronjobs the backend. In Shopware6 these background tasks are now a combination of ScheduledTasks and a…

---

<div class="post-metadata">

### Author: ![kathi](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/kathi/32/20047_2.png) [@kathi](https://forum.shopware.com/u/kathi)
#### Post date: [19. Dezember 2024 um 10:42 UTC](https://forum.shopware.com/t/how-to-execute-a-specific-scheduled-task-in-shopware-6/63771/7 "2024-12-19T10:42:02Z")

</div>

You certainly found the solution in the meantime, but for the records, with the following command you can run a single scheduled task:

```auto
bin/console scheduled-task:run-single <taskName>

```

But in regards to debugging a failed job, I am also looking for help.

**What I know so far:**  
When you can reproduce the bug in your local environment and you have Xdebug running, you can debug the task (let’s say `shopware.sitemap_generate`) by setting a breakpoint as usual and then running the single task as follows:

```auto
XDEBUG_SESSION=1 bin/console scheduled-task:run-single shopware.sitemap_generate

```

Review the log files might help. When Supervisor is running your scheduled tasks, there must be log files somewhere. By default they are located under `$CWD/supervisord.log` (see the [Supervisor docs](https://supervisord.org/configuration.html#supervisord-section-values)). Check the program definition for the actual location of your log files with `cat /etc/supervisor.d/<nameOfYourScheduledTaskProgram>.conf`.

I can strongly recommend the free [FroshTools plugin](https://github.com/FriendsOfShopware/FroshTools) which gives you a neat overview in your Shopware Administration. It allows you to comfortably run a specific task or change its interval or next execution time (see [screenshots](https://github.com/FriendsOfShopware/FroshTools?tab=readme-ov-file#screenshots)).
