Cron
•
CRON 은 리눅스와 유닉스 기반 시스템에서 사용되는 예약 작업 스케줄러이다.
•
CRON 은 미리 정의된 일정에 따라 주기적으로 또는 일회성으로 명령을 실행하도록 설정가능
Syntax
[분] [시] [일] [월] [요일]
Field | Value | Wildcards |
분 | 0 ~ 59 | , - * / |
시 | 0 ~ 23 | , - * / |
일 | 1 ~ 31 | , - * ? / L W |
월 | 1 ~ 12 | , - * / |
요일 | 0 ~ 6 | , - * ? L # |
년 | 1970 ~ 2199 | , - * / |
WildCard
Wildcards | Meaning | Example |
* (asterisk) | includes all values in the field | " * * * * *" 는 매 분 매 시간 매일 매월 매요일에 해당하는 모든 값을 나타냅니다. |
/ (forward slash) | a step value | "*/5"는 5분마다 한 번씩을 나타냅니다. |
, (comma) | a list of values | "0,15,30,45"는 0, 15, 30 및 45를 나타냅니다. |
- (dash) | a range of values | "1-5"는 1부터 5까지의 값을 나타냅니다. |
? (question mark) | no specific value | in the days of the week field when the day of the month is specified (or vice versa) |
L | the last occurrence of a day of the week or month | |
W | the nearest weekday to a given day of the month |
•
예시) 매일 2:30 AM
30 2 * * *
•
예시) 매주 일요일
"0 0 * * 0"
•
예시) 매 15분마다 실행
"*/15 * * * *"
•
매일 오후 5시에 실행
0 17 * * *
•
매월 1일 자정에 실행
0 0 1 * *
•
평일(월-금)마다 오전 9시에 실행
0 9 * * 1-5
•
매시간 30분에 실행
30 * * * *
•
매월 마지막 날 오후 11시에 실행
0 23 L * *
•
매주 월요일과 수요일 오전 8시 30분에 실행
30 8 * * 1,3
•
매일 오전 8시부터 오후 5시까지 매 시간마다 실행
0 8-17 * * *
•
매월 1일, 15일 오전 6시에 실행
0 6 1,15 * *
•
3개월마다 1일 자정에 실행
0 0 1 */3 *
•
매년 12월 25일 오전 7시에 실행
0 7 25 12 *

