Crontab

Crontab

Crontab

리눅스에서 스케줄링하여 원하는 시간에 작업을 실행할 수 있는 유용한 툴이다.
  • 현재 로그인한 사용자의 crontab 파일 수정, 생성
    crontab -e
  • 현재 로그인한 사용자의 crontab 파일 내용 보기
    crontab -l
  • crontab 파일 문법
    *      *      *      *      * command
    분(0-59)  시간(0-23)  일(1-31)  월(1-12)   요일(0-7) 실행
매분 test.sh 실행
* * * * * /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

댓글

가장 많이 본 글