Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
Run a job with (Spring @Scheduled) on specific days

I have a customer check job. I could not find how to automatically set the job time to run on 10am only on Monday, Friday and Saturday. Is there a possible way to set it using Spring @Scheduled?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I found the solution like this:

@Scheduled(cron = "0 0 10 * * MON,FRI,SAT")
public void dailyScheduleJob() {
    /*
    your code here
    */
}

Additionally, if the requested days are sequential such as Monday to Friday(a job running only on weekdays), this expression is shorter:

@Scheduled(cron = "0 0 10 * * MON-FRI")
public void dailyScheduleJob() {
    /*
    your code here
    */
}

It is also possible to represent days with numbers from 1-7. In this case 1 will be SUN, and 7 will be SAT and the same cron job above can be written like this:

@Scheduled(cron = "0 0 10 * * 2-6")
public void dailyScheduleJob() {
    /*
    your code here
    */
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!