VMware GemFire

 I'm using PCF scheduler for scheduling the job. I'm not able to get a cron expression which will bring up by job every month first Tuesday at 1:00 A.M EST.

Venkatesh Srinivasan's profile image
Venkatesh Srinivasan posted Jul 04, 2019 03:36 PM

 I was able to get up to up to every Tuesday 1:00. The expression 0 1 ? * 3. I'm not able to crack the every first Tuesday of the month portion. Please help

Daniel Mikusa's profile image
Daniel Mikusa

My understanding is that PCF Scheduler use the cron format that's supported by Quartz, except that it doesn't allow you to configure jobs down to the second, so it's one field shorter than the standard Quartz format.

 

http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html#format

 

You can use a tool like this one to put together your cron expressions. Just remember to take off the right most field which represents seconds.

 

https://freeformatter.com/cron-expression-generator-quartz.html

 

Hope that helps!

Venkatesh Srinivasan's profile image
Venkatesh Srinivasan

I have tried all these options but nothing works. As per the https://freeformatter.com/cron-expression-generator-quartz.html.

The cron expression for my need is 0 0 7 ? * 3#1 *. This will be told as invalid expression even while creating schedule. Please see these blogs

https://medium.com/@christophef/scheduler-with-cloud-foundry-2f98d3daef35 . This clearly states that PCF scheduler uses custom cron that is not documented. In fact it is a larger pain for the dev.community to use PCF scheduler. Is there something that can be addressed? Also can you please help with the correct cron expression

Daniel Mikusa's profile image
Daniel Mikusa

>The cron expression for my need is 0 0 7 ? * 3#1 *. This will be told as invalid expression even while creating schedule. 

 

OK, so this is the right expression. That's step #1. Now chop off the left most 0 (sorry, I said right most in my original note). That's the seconds field, and PCF Scheduler does not support resolution down to the second. That leaves you with `0 7 ? * 3#1 *`. Paste that into the form to schedule your task and click "Update". That should be accepted. It worked for me with PAS 2.4 and Scheduler 1.2.23.

 

Screen Shot 2019-07-08 at 10.54.32 AM

 

>see these blogs

https://medium.com/@christophef/scheduler-with-cloud-foundry-2f98d3daef35 . This clearly states that PCF scheduler uses custom cron that is not documented. 

 

I disagree with what's posted in this blog. It's documented here.

 

>You can schedule a job to execute at any time using a schedule expression. Scheduler for PCF requires Cron expressions in the

MIN HOUR DAY-OF-MONTH MONTH DAY-OF-WEEK

format.

 

https://docs.pivotal.io/pcf-scheduler/1-2/using-jobs.html#schedule-job

 

Although my experience with it is that the format is more permissive than that. It also takes `MIN HOUR DAY-OF-MONTH MONTH DAY-OF-WEEK YEAR`, i.e. `0 7 ? * 3#1 *`.

 

Hope that helps!

Venkatesh Srinivasan's profile image
Venkatesh Srinivasan

Hi Daniel Mikusa,

Thanks for the elaborate answer. I got this working. Again thanks for your help.