dev2016. 3. 25. 16:38

크론 실행 확인

ps -ef | grep crond


crontab 명령어

 - crontab [-u 사용자 id] 파일

 - crontab [-u 사용자 id] { -l | -r | -e }


* crontab -l : 예약된 작업리스트

* crontab -e : 예약된 작업 수정

* crontab -r : 예약된 작업 삭제

* crontab -u 사용자명 : 루트관리자는 해당 사용자의 crontab 파일을 보거나 삭제, 편집가능


등록 형식

*    *    *    *    *  수행할 명령어
┬   ┬   ┬   ┬   ┬
│   │   │   │   │
│   │   │   │   │
│   │   │   │   └───────── 요일 (0 - 6) (0 =일요일)
│   │   │   └────────── 월 (1 - 12)
│   │   └─────────── 일 (1 - 31)
│   └──────────── 시 (0 - 23)
└───────────── 분 (0 - 59)


출처 및 참고

http://webdir.tistory.com/174

http://zetawiki.com/wiki/리눅스_반복_예약작업_cron,_crond,_crontab

http://luckys.tistory.com/162



* 그런데 만약 crontab 을 스크립트로 변경하고 싶으면?

Here's a one-liner that doesn't use/require the new job to be in a file:

(crontab -l 2>/dev/null; echo "*/5 * * * * /path/to/job -with args") | crontab -

The 2>/dev/null is important so that you don't get the no crontab for username message that some *nixes produce if there are currently no crontab entries.

http://stackoverflow.com/questions/4880290/how-do-i-create-a-crontab-through-a-script