LinkedNestBlog

Cron Expression

by Dev Jinwon
Cron Expression


ref.]
1. CronTrigger Tutorial : http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger
2. Quartz CronTrigger로 알아보는 Cron 표현식 :  http://chanlee.github.io/2014/01/18/cron-expression-with-quartz-cron-trigger/


1. 포맷
Field Name Mandatory 허용 값 범위 허용 특수문자
seconds(초) yes 0-59 , - * /
minutes(분) yes 0-59 , - * /
hours(시) yes 0-23 , - * /
day of month(일) yes 1-31 , - * ? / L W
month(월) yes 1-12 or JAN-DEC , - * /
day of week(주) yes 1-7 or SUN-SAT , - * ? / L #
year(년) no empty, 1970-2099  , - * /


2. 특수문자

to-do

3. 사용 예
Expression Meaning
0 0 12 * * ? 매일 낮 12시
0 15 10 ? * * 매일 오전 10:15
0 15 10 * * ? 매일 오전 10:15
0 15 10 * * ? * 매일 오전 10:15
0 15 10 * * ? 2005 2005년 매일 오전 10:15
0 * 14 * * ? 매일 14:00~14:59
0 0/5 14 * * ? 매일14:00~14:55까지 5분 간격으로 
0 0/5 14,18 * * ? 매일 14:00~14:55까지, 18:00~18:55까지 5분 간격으로
0 0-5 14 * * ? 매일 14:00~14:05 사이
0 10,44 14 ? 3 WED 3월 매주 수요일 14:00, 14:44에 실행 
0 15 10 ? * MON-FRI 매주 월요일~금요일 오전 10:15에 실행 
0 15 10 15 * ? 매월 15일 오전 10:15에 실행 
0 15 10 L * ? 매월 말일 오전 10:15에 실행 
0 15 10 ? * 6L 매월 마지막 금요일 오전 10:15에 실행
0 15 10 ? * 6L 2002-2005 2002~2005년 매월 마지막 금요일 오전 10:15에 실행 
0 15 10 ? * 6#3 매월 세번째 금요일 오전 10:15에 실행 
0 0 12 1/5 * ? 매월 1~5일 낮 12:00에 실행 
0 11 11 11 11 ? 11월 11일 오전 11:11에 실행 
Cron Expression · LinkedNest Blog