简体   繁体   中英

Java Cron Jobs Stop for one hour a day? (ex: 10.30 to 11.30)

I am developing java application and in this i wanted to run some method periodically. I have used java schedule to run that method periodically. This is my Cron Expression.

public static String CRON_TIME = "2 0/10 0-9.30,11.30-23 * * ?"; /* This should run in every 10 minutes excluding 10.30am to 11.30am(1 hour)*/

This is not works as i expected. How I can write Cron Expression to do it? Give me a idea.

Your expression will not work as the hours range includes minutes (0-9.30, 11.30-23)

You will need to set up multiple triggers calling the same method.

  1. every 10 minutes for hours 0-8 (2 0/10 0-8 * * ?)
  2. 0/10/20 for hour 9 (2 0,10,20 9 * * ?)
  3. 40/50 for hour 11 (2 40,50 11 * * ?)
  4. every 10 minutes for hours 12-23 (2 0/10 12-23 * * ?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM