You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by CMoH <gi...@git.apache.org> on 2017/08/12 22:21:45 UTC
[GitHub] karaf pull request #335: Add karaf command scheduler:trigger
GitHub user CMoH opened a pull request:
https://github.com/apache/karaf/pull/335
Add karaf command scheduler:trigger
Allow console users to manually trigger jobs from the karaf scheduler list.
Example:
```
karaf@root()> scheduler:schedule --name test --period 60 { echo $(date) }
karaf@root()> Aug Sun 13 00:47:53 2017
scheduler:trigger test
Triggered job test
karaf@root()> scheduler:trigger -b test
Scheduling background trigger for job test
Aug Sun 13 01:14:50 2017
```
The `scheduler:trigger` command works well with non-shell jobs, but triggering karaf scripts sometimes generates a conflict with Felix:
```
2017-08-13 00:47:57,571 | WARN | null_Worker-2 | ScriptJob | 52 - org.apache.karaf.scheduler.core - 4.2.0.SNAPSHOT | Error executing script
java.lang.IllegalStateException: A job is already in foreground
at org.apache.felix.gogo.runtime.CommandSessionImpl$JobImpl.foreground(CommandSessionImpl.java:643) [42:org.apache.karaf.shell.core:4.2.0.SNAPSHOT]
at org.apache.felix.gogo.runtime.CommandSessionImpl$JobImpl.start(CommandSessionImpl.java:760) [42:org.apache.karaf.shell.core:4.2.0.SNAPSHOT]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:295) [42:org.apache.karaf.shell.core:4.2.0.SNAPSHOT]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:168) [42:org.apache.karaf.shell.core:4.2.0.SNAPSHOT]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:148) [42:org.apache.karaf.shell.core:4.2.0.SNAPSHOT]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand$VersatileFunction.execute(SecuredCommand.java:107) [42:org.apache.karaf.shell.core:4.2.0.SNAPSHOT]
at org.apache.karaf.scheduler.command.support.ScriptJob.execute(ScriptJob.java:43) [52:org.apache.karaf.scheduler.core:4.2.0.SNAPSHOT]
at org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:53) [52:org.apache.karaf.scheduler.core:4.2.0.SNAPSHOT]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [52:org.apache.karaf.scheduler.core:4.2.0.SNAPSHOT]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [52:org.apache.karaf.scheduler.core:4.2.0.SNAPSHOT]
```
The `scheduler:trigger -b` command tries to avoid this by scheduling a job that in turns runs the trigger (hopefully) after the foreground console command has finished.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/CMoH/karaf scheduler-trigger-command
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/karaf/pull/335.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #335
----
commit 69b47c37475013e6a3e2cc19f01a56c4035b3d06
Author: Ciprian Ciubotariu <ch...@gmx.net>
Date: 2017-08-09T13:43:58Z
Add manual trigger command to karaf scheduler
Allow console users to trigger jobs from the karaf scheduler list
Provide an option to run the trigger in the background to avoid
conflicts with the console foreground job
fix#
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] karaf pull request #335: Add karaf command scheduler:trigger
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/karaf/pull/335
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---