■ crontab 옵션
crontab -e : 편집
crontab -l : 목록 보기
crontab -j : 삭제
■ 기본 포맷
* * * * *
분(0-59) 시간(0-23) 일(1-31) 월(1-12) 요일(0-7)
■ 사용 예제
# 매분 test.sh 실행
* * * * * /home/script/test.sh
# 매주 금요일 오전 5시 45분에 test.sh 를 실행
45 5 * * 5 /home/script/test.sh
# 매일 매시간 0분, 20분, 40분에 test.sh 를 실행
0,20,40 * * * * /home/script/test.sh
# 매일 1시 0분부터 30분까지 매분 tesh.sh 를 실행
0-30 1 * * * /home/script/test.sh
# 매 10분마다 test.sh 를 실행
*/10 * * * * /home/script/test.sh
# 5일에서 6일까지 2시,3시,4시에 매 10분마다 test.sh 를 실행
*/10 2,3,4 5-6 * * /home/script/test.sh
■ 로깅 예제
* * * * * /home/script/test.sh > /home/script/test.sh.log 2>&1
* * * * * /home/script/test.sh >> /home/script/test.sh.log 2>&1
* * * * * /home/script/test.sh > /dev/null 2>&1
※ 2>&1는 표준출력 외 표준에러까지 출력