# 개요

프로젝트 개발 중에, cron을 사용해야하는 경우가 생겨서, 조사하게 되었다. 하나로 통일했으면 좋았을 텐데, 또 별도로 나뉘었다.

 

# Quartz Cron Expression Format

 

Quartz Cron Expressions Support up to Seven Fields

Name

Required

Allowed Values

SpecialCharacters

Seconds

Yes

0-59

, - * /

Minutes

Yes

0-59

, - * /

Hours

Yes

0-23

, - * /

Day of Month

Yes

1-31

, - * ? / L W C

Month

Yes

1-12 or JAN-DEC

, - * /

Day of Week

Yes

1-7 or SUN-SAT

, - * ? / L C #

Year

No

Blank or 1970-2099

, - * /

 

The ? character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'.
The * character means 'every'

 

# 일반 Cron Expression Format

Field Required Allowed values Allowed special characters Remarks
Minutes Yes 0-59 * , -
Hours Yes 0-23 * , -
Day of month Yes 1-31 * , - ? L W ? L W only in some implementations
Month Yes 1-12 or JAN-DEC * , -
Day of week Yes 0-6 or SUN-SAT * , - ? L # ? L # only in some implementations
Year No 1970-2099 * , - This field is not supported in standard/default implementations.

 

# 기호 설명

* : 모든 값을 뜻합니다.

? : 특정한 값이 없음을 뜻합니다.

- : 범위를 뜻합니다. (예) 월요일에서 수요일까지는 MON-WED로 표현

, : 특별한 값일 때만 동작 (예) 월,수,금 MON,WED,FRI

/ : 시작시간 / 단위  (예) 0분부터 매 5분 0/5

L : 일에서 사용하면 마지막 일, 요일에서는 마지막 요일(토요일)

W : 가장 가까운 평일 (예) 15W는 15일에서 가장 가까운 평일 (월 ~ 금)을 찾음

# : 몇째주의 무슨 요일을 표현 (예) 3#2 : 2번째주 수요일

 

# 차이점

- 일반 Cron은 Minites까지만 지원, 또한 SUN-SAT이 0-6로 매핑

- Quartz Cron은 Second도 지원 , 또한 SUN-SAT이 1-7로 매핑

 

# 출처

https://flylib.com/books/en/2.65.1/the_cron_expression_format.html

https://zamezzz.tistory.com/197 [배워가는블로거]

https://en.wikipedia.org/wiki/Cron#CRON_expression

'[DEV] Developer 회고' 카테고리의 다른 글

Event Sourcing의 개념  (0) 2020.11.19
[개념정리] Apache Tomcat, Web/Was 이해하기  (0) 2020.09.15
Window 개발시, 유용한 Tip  (0) 2020.07.27
웹훅[Webhook]이란?  (0) 2020.07.09
Web 개발의 흐름  (0) 2020.07.08
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기