Can I have both cron and simple trigger for quartz? - quartz-scheduler

I want to run Quartz Job using both triggers: cron and simple. Or are other ways to specify multiple intervals for one job?
<trigger>
<cron>
<name>Trigger_Name</name>
<job-name>Job_Name</job-name>
<job-group>DEFAULT</job-group>
<!-- It will run every day at 00hr-->
<cron-expression>0 0 0 * * ?</cron-expression>
</cron>
<simple>
<name>Trigger_Name</name>
<group>DEFAULT</group>
<job-name>Job_Name</job-name>
<job-group>DEFAULT</job-group>
<repeat-count>-1</repeat-count>
<repeat-interval>10000</repeat-interval>
</simple>
</trigger>

Related

Rundeck multiple job executions, queued or discarded?

Rundeck docs for creating a job,
https://docs.rundeck.com/docs/manual/creating-jobs.html#creating-a-job
says:
Multiple Executions
By default, a job runs as a "Single Execution" -- it can only have a single execution running at a time. This is useful if the steps the Job performs might be interfered with if another separate process was also performing them on the same Node(s).
However, in some cases it is useful to allow a Job to be executed more than once simultaneously.
You can make a job allow "Multiple Executions" by toggling the value to Yes in the Job editor field shown below:
my questions:
For the default "Single Execution" mode, what happens to subsequent simultaneous job runs? Are they discarded or queued?
For "Multiple Execution" mode, what happens to subsequent simultaneous job runs that exceed the "Max number of multiple executions"? Are they discarded or queued?
Thanks for any guidance.
You can test with a simple job definition like this:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>72fe54d5-26da-4cd4-a487-0955bd3b7f67</id>
<loglevel>INFO</loglevel>
<name>HelloWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>sleep 15; echo "hello"</exec>
</command>
</sequence>
<uuid>72fe54d5-26da-4cd4-a487-0955bd3b7f67</uuid>
</job>
</joblist>
In case of execute again the job you can see this error.
So, if you modify the job to allowing "two multiple execution" you can see that works normally with 2 executions of the same job:
<joblist>
<job>
<defaultTab>nodes</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>72fe54d5-26da-4cd4-a487-0955bd3b7f67</id>
<loglevel>INFO</loglevel>
<maxMultipleExecutions>2</maxMultipleExecutions>
<multipleExecutions>true</multipleExecutions>
<name>HelloWorld</name>
<nodeFilterEditable>false</nodeFilterEditable>
<plugins />
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<exec>sleep 15; echo "hello"</exec>
</command>
</sequence>
<uuid>72fe54d5-26da-4cd4-a487-0955bd3b7f67</uuid>
</job>
</joblist>
But if you execute three times the same job, you can see the same error of first scenario.
Short answer: if you exceed the default value or defined value, the execution is discarded.

When cron file will execute if crontab has schdule earlier then server cron

To set the magento cron we need to add following commands in crontab file on server.
*/10 * * * <path to php binary> <magento install dir>/bin/magento cron:run
*/10* * * * <path to php binary> <magento install dir>/update/cron.php
*/10 * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run
and we can create the custom cron with crontab.xml
<group id="default">
<job name="custom_cronjob" instance="Magento\SampleMinimal\Cron\Test" method="execute">
<schedule>*/5 * * *</schedule>
</job>
</group>
As you can see default magento cron is set for every 10 minutes and magento custom cron is set every 5 minutes.
So my question is custom cron will execute in every 15 minutes or will it execute in every 5 minutes?
You must to install magento crontab by command:
php bin/magento cron:install
In magento 2, cron runs every minute. After install, you will see:
* * * * * /usr/bin/php7.0 /var/www/html/your_project/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/your_project/var/log/magento.cron.log
* * * * * /usr/bin/php7.0 /var/www/html/your_project/update/cron.php >> /var/www/html/your_project/var/log/update.cron.log
* * * * * /usr/bin/php7.0 /var/www/html/your_project/bin/magento setup:cron:run >> /var/www/html/your_project/var/log/setup.cron.log

How to run Batch Job EST 1:00 AM everyday?

In salesforce is there any way to run the Batch Job midnight at EST time everyday ?
I know following cron runs everyday at 1:00 AM. But not sure on which timezone will it run ?
Cron format ==>
0 0 1 1/1 * ? *
I dont see a way to configure the timezone actually. Any way ?
System.schedule('TSAMPLE Job1', '0 0 1 1/1 * ? *', new My_Scheduler());
Like mentioned here:
Apex Scheduler the The System.Schedule method uses the user's timezone for the basis of all schedules.
Hope this helps.

Cron status always remain "running" in magento 2

I have created a custom module and added crontab file to run cron related task.
<group id="index">
<job name="custom_orderprocess" instance="Test\Module\Cron\Check" method="execute">
<schedule>* * * * *</schedule>
</job>
</group>
Although I can see the cron is scheduled but its status always remain "running" (never show success).
I have also for infinite loop (removing all code except return statement) but still no luck.
Can some one guide me
If cron is in running state then may be some error in your cron function.

Cronjob Pausing between 00:00 and 01:00

I know, there are many contents about cronjob. But i'm uncertain.
I need a Cron that run all 5 minutes. This Cron shouldn't run between 00:00 and 01:00 (in the night)
My cron
*/5 01-23 * * * balbalabalabal > aaa
Is this right?
Running this cron at 23.05, 23.10....23.55 and start again at 01:00?
best regards!
Ok I tested this.
The Cron runs at 23.05, 23.10..... until 23.55.
Then pausing and the first Cronjob start again at 01.00