How to execute a specific scheduled task in shopware 6? - plugins

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

It is not possible to execute a scheduled task directly. But you could create a consoleCommand which then executes your ScheduledTaskHandler. Remember to insert your ScheduledTaskHandler dependency into your command command in the services.xml.

Related

Cancelling all notStarted or inProgress tasks if job is cancelled

I have a pipeline in AzureDevOps. It install several NPM dependencies and afterwards I use npm run <script_name>.
However if I cancel the job it still spawns webdrivers and it can be seen that the job is still running based on the counter.
Is there a way to cancel the tasks which are inProgress/notStarted if I cancel an ongoing job?
Thank you
Is there a way to cancel the tasks which are inProgress/notStarted if I cancel an ongoing job?
This needs to be explained in a case-by-case basis.
One case is that the task has not started yet after you choose to cancel the job. In this case, the task will not start.
Another case is that the task is inProgress when you cancel the job. This situation depends on the specific circumstances of your task running.
If your task just runs its own task, it can be canceled.
But if your task executes the task by calling other programs through the command,like using command line task invoke MSBuild.exe to build the project, there is no way to cancel the task after the command is issued. Even if you cancel the job, the task is still executed in the background until the job is completely closed.

is my script running as a scheduled task?

I have some CMD/ Powershell scripts which may be run from the command line or as a scheduled task.
When in scheduled task, some options may not be available (eg. GUI) and some need to be used differently (eg. error logging to file/ event log instead of screen).
Is there a way to find if the script is currently running as a scheduled task and the name of the scheduled task (for logging purpose)?
If needed, I can use advanced programming tools such ad .NET, C#, etc.

How to run only specific task within a Job in Rundeck?

I have a job in Rundeck with many tasks within, but when some task fails I have to duplicate de Job, remove all the other tasks, save it and then run this new reduced copy of my original job.
Is there a way to run only specific tasks without having to do all this workaround?
Thanks in advance.
AFAIK there is no way to do that.
As a workaround, you can simply add options for every step in your Rundeck job, so for instances, if you have 3 script steps in your job, you can add 3 options named: skip_step_1, skip_step_2 and skip_test_3 and then assign true to the ones that have finished successfully and false to the one that has failed in the first execution. And for every script step, you can add a condition whether to run it or not.
A smiliar feature request is already proposed to the rundeck team :
Optionally execute workflow step based on job options

Create new cron job Task Scheduler from SocialEngine admin control panel

I'm new to socialengine framework. Can any one help me how to create new cron job Task Scheduler from socialengine admin panel?
The task scripts are in application/modules/Core/Plugin/Task in the newest build of SocialEngine and we generally set them to run every 60 seconds at 5 second spacing between scripts.
You won't be able to create a cron job from the admin panel. You would need to set it up with your server. Your hosting provider should be able to assist you. The jobs you will need to schedule can be found in the following directory depending on what task you want to schedule: application/modules//Plugin/Task

Calling a Cron Trigger stored in JDBCJobStore programmatically

I have a Cron Trigger configured using the JDBCJobStore since we will be running the app within a clustered environment.
I have the CronTrigger running every 10AM, everything is working great.
How would I programmatically start this Cron Trigger "On-Deman". Any code sample appreciated.
I'm using Quartz 1.6.5 on Tomcat 6.0.
Thanks for any help.
If you know the name and group of the job you wish to run "on demand", and you have programmatic access to the scheduler, you could schedule a new SimpleTrigger to run once and immediately.
http://quartz.sourceforge.net/javadoc/org/quartz/Scheduler.html
Note that this would not start the cron trigger, I am assuming your goal is to actually run the job your cron trigger points to. If you have code that relies on TriggerListeners listening to your cron trigger, this will not help.