How can I setup Gramex scheduler on first monday of month and first monday of a quarter?

36 Views Asked by At

I tried this piece of code but it sends for every Monday every month or quarter. How can I restrict it to only the first Monday?

schedule:
  email-alerts-monthly:
    function: mymodule.check_email_alerts()
    weekday: mon
    months: '*' 
    utc: true

email-alerts-quarterly:
    function: mymodule.check_email_alerts()
    weekday: mon
    months: 'jan, apr, jul, oct' 
    utc: true

Any suggestions?

1

There are 1 best solutions below

0
On BEST ANSWER

For the first Monday, add dates: 1-7. That will skip all subsequent weeks in the month, and still run it only on the first Monday.

schedule:
  email-alerts-monthly:
    function: mymodule.check_email_alerts()
    dates: 1-7
    weekday: mon
    months: '*' 
    utc: true

email-alerts-quarterly:
    function: mymodule.check_email_alerts()
    dates: 1-7
    weekday: mon
    months: 'jan, apr, jul, oct' 
    utc: true