cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to schedule job in workflow for every 30 days

pcbzmani
New Contributor II

Dear All - I want to schedule a job in Workflow for every 30 days. So, when i try the below CRON expression it gives invalid cron expression. Anyone who already implemented this?

0 0 */30 * *

 

7 REPLIES 7

Vinay_M_R
Databricks Employee
Databricks Employee

To schedule a job in a workflow to run every 30 days, follow these steps:

1. Go to the "Workflows" section in the sidebar.
2. Find the job you want to schedule in the "Name" column on the "Jobs" tab and click on it.
3. In the "Job details" panel, click on "Add trigger".
4. Select "Scheduled" as the trigger type.
5. Specify the period as "Monthly" and choose the starting time and time zone.
6. Click on "Save".

Example of a cron expression for running a job every 30 days:

0 0 1 */30 * ?


Please note that the cron expression may vary depending on your specific scheduling requirements and the platform you are using.

pcbzmani
New Contributor II

Hello @Vinay_M_R  -> I want jobs to run on 30 days interval not on monthly. Reason for this to have log on every 30 days.

Vinay_M_R
Databricks Employee
Databricks Employee

Hi @pcbzmani 

A cron expression doesn't inherently support the concept of running a job for a specific number of days and then stopping. Cron is designed to schedule recurring tasks at regular intervals.

If you want to run a job every day for up to 30 days, you could use the cron expression "0 0 * * *" to run the job every day at midnight. However, you would need to implement additional logic outside of the cron schedule to stop the job after 30 days.

This could be done, for example, by storing the start date of the job in a database or file, and then checking this date each time the job runs. If the current date is 30 days or more after the start date, the job could then stop itself.

Again, the exact implementation of this would depend on the system you're using to schedule and run your jobs.

Aviral-Bhardwaj
Esteemed Contributor III

use this website https://crontab.guru/ , here you will get good idea

AviralBhardwaj

VaibB
Contributor

You could go to the crontab and set the expression as 0 0 */30 * *

pcbzmani
New Contributor II

This is not working. Getting Invalid Quartz Cron Expression

Tharun-Kumar
Databricks Employee
Databricks Employee

@pcbzmani 

Could you try 0 0 0 1/30 * ? *

Databricks uses Quartz cron syntax and we have to provide 1/30 for day to achieve a schedule for 30 days.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group