How to refresh a VDB on the first Sunday of each month?

  • 0
  • 1
  • Question
  • Updated 3 months ago
  • Answered
I need some help because that cron expression doesn't help to refresh a VDB on the 1st Sunday of each month.
Photo of Tako Au

Tako Au

  • 110 Points 100 badge 2x thumb
  • upset

Posted 3 months ago

  • 0
  • 1
Photo of Matt Griffith

Matt Griffith

  • 458 Points 250 badge 2x thumb
Hi Tako,

I haven't tested this with Delphix but a standard way to run a job on the first Sunday of every month using cron is to put a test in the expression like:

0 9 1-7 * * [ $(date +\%u) = 7 ] && YourScript

Here we are saying, if the day number of the current date is 7 (a Sunday) run the YourScript and we will only run the script in the first 7 days of the month (1-7).

So we need to know what Delphix will allow us to put in the custom cron expression so I suggest you test it.  Start with this:

0 9 1-7 * * [ $(date +\%u) = 7 ] &&

Hopefully Delphix just appends it's refresh script to the end of the cron expression so it will work.  I'll test it myself when I get a chance but let me know how it goes.
Photo of Tako Au

Tako Au

  • 110 Points 100 badge 2x thumb

Hi Matt,

Thanks for your quick reply.  It will definitely run on crontab but Delphix is very intelligent to find out it's not a proper cron expression =( :

30 5 1-7 * * [ $(date +\%u) = 7 ] &&
Incorrectly formatted cron expression.

and in CLI:
update scheduleList 0 *> commit
   Error: The policy could not be applied because the schedule "30 5 1-7 * * [ $(date +\%u) = 7 ] &&" is invalid.
  Action: Check the schedule string and try again.

(Edited)
Photo of Matt Griffith

Matt Griffith

  • 458 Points 250 badge 2x thumb
Tako,

I've just checked and it is actually much simpler than my first example.  Delphix uses the Quartz CronTrigger Scheduler so this should work nicely...

0 0 9 ? * 7#1

(Edited)
Photo of Tako Au

Tako Au

  • 110 Points 100 badge 2x thumb
Hi Matt,

Thanks again.  I've checked how Quartz cron works and put a refresh policy 0 0 5 ? * 7#1.  Will let you know next Monday whether it works or not  =)

imo Delphix GUI needs improvement.  Most of the tasks involves CLI...

ps. I'm newbie to Delphix

Regards,
Tako
Photo of MichaelT

MichaelT, Official Rep

  • 656 Points 500 badge 2x thumb
Hi Tako,
Can you explain why you'd like to only refresh your VDBs monthly? The scheduler allows for a shorter time span than that, at weekly or daily or hourly. I'm just looking to understand the longer time frame so that I can request the feature for you and put it in front of our product team. 

@Matt, thank you so much for stepping in here. Cron is not the friendliest format.

Quick question to you both, don't we want 1#1 in the last field to reflect the 1st Sunday of each month? (http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html )

Thanks,
Michael
(Edited)
Photo of Matt Griffith

Matt Griffith

  • 458 Points 250 badge 2x thumb
Well spotted Michael.  1-7 = Sun-Sat in this format.  

Tako, you need a 1 not a 7.