Monday, March 14, 2022

[SOLVED] I want schedule a task for every 24 hours by using cron expression settings

Issue

I want to schedule a method to run every 24 hours and with the settings I have it is executing every 24 minutes.

I have referred below URL's which has different suggestions

href="https://www.baeldung.com/cron-expressions" rel="nofollow noreferrer">Link 1 suggests <second> <minute> <hour> <day-of-month> <month> <day-of-week> <year> <command>

Link 2 suggests minute hour day(month) month day(week)

Below are the cron settings put in the application.yml of my Spring Boot application.

cron: job: expression: 0 0 23 * * ?

Could someone help on what are the correct source of information and what can be the settings with the requirements at hand.


Solution

If you run the scheduled job in spring the record must be as mentioned in first link:

0 0 23 * *

This will run the job at 23:00:00 every day



Answered By - Romeo Ninov
Answer Checked By - Willingham (WPSolving Volunteer)