May 27, 2019

What is Crontab


cronatab file.
A crontab file is a file that is processed by the cron daemon and defines a list of tasks to be performed on a regular basis.

cronatab 파일.
crontab 파일은 cron 데몬에 의해 처리되는 파일이며, 정기적으로 수행해야할 작업 목록을 정의한다.

crontab commands.
crontab 관련 명령어.

$ crontab -e flag04
Edit crontab file of flag04 account.
flag04 계정의 crontab 파일을 수정.

$ crontab -l flag04
List the contents of the crontab file for the flag04 account.
flag04 계정의 crontab 파일을 열람.

$ crontab -l
List the contents of the crontab file for my account.
자신의 crontab 파일을 열람.

$ crontab -r
Remove the crontab file for my account.
자신의 crontab 파일을 제거.

How to read the contents of a crontab file
crontab 파일의 내용 읽는 방법

The total fields are separated into six parts.
minute, hour, day, month, day of week, task

총 6개의 필드로 구분
분, 시, 일, 월, 요일, 작업

e.g 1.
0 4 * * * /tmp/task1 arg1 arg2
→Runs task1 at 4 am every day, including arg1 and arg2 arguments.
→매일 새벽 4시 정각에, arg1, arg2 아규먼트를 포함하여 task1을 실행한다.

*/5 * * * * /tmp/task2
→Run task2 every 5 minutes.
→매 5분마다 task2를 실행한다.

10 16 * * 1-4 /tmp/task3
10 16 * * 5-7 /tmp/task4
→From Monday to Thursday, at 16:10, run task3,
→From Friday to Sunday, at 16:10, run task4,
→월~목요일, 16시 10분엔 task3을 수행하고,
→금~일요일, 16시 10분엔 task4를 수행한다.