반응형
crontab 못찾는다고 할 경우 설치
$ yum install vixie-crontab
OR
$ yum install crontabs
서비스 시작
$ service crond start
부팅시 서비스 시작 등록
$ chkconfig crond on
크론탭 서비스 정상인지 확인하려면 crontab -e 명령어 사용한 후에 아래 내용을 기입
$ crontab -e
* * * * * echo "Cron Worked $(date)" >> /home/c.txt |
1분마다 생성되므로 1분 후에 /home/c.txt 파일의 내용을 확인
만약 5분마다 실행시에는 */5로 하면 0, 5, 10... 등으로 5분마다 실행된다.
crontab -e Edit your crontab file, or create one if it doesn’t already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)
* * * * * command to be executed - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59) |
문서에 아래 같은 값으로 이루어져 있고 sh파일이 해당 내역을 실행시키는 내용을 포함하고 있다.
0 2 * * * /home/bin/mailing.sh |
$ /etc/rc.d/init.d/crond [start/restart/stop]을 통해서 크론탭 수정한 값을 시스템에 적용한다.
min | hour | day/month | month | day/week | Execution time |
30 | 0 | 1 | 1,6,12 | * | – 00:30 Hrs on 1st of Jan, June & Dec. |
0 | 20 | * | 10 | 1-5 | –8.00 PM every weekday (Mon-Fri) only in Oct. |
0 | 0 | 1,10,15 | * | * | – midnight on 1st ,10th & 15th of month |
5,10 | 0 | 10 | * | 1 | – At 12.05,12.10 every Monday & on 10th of every month |
: |
만약에 Log를 syslog와 다르게 독립적으로 기록하기를 원한다면
$ /etc/rsyslog.conf
crontab 주석 해제 후 재시작
$ /etc/init.d/rsyslog restart
반응형
'리눅스 > 리눅스 - 공통' 카테고리의 다른 글
[리눅스] 방화벽 (0) | 2013.03.16 |
---|---|
[리눅스] marvel 랜 드라이버 설치 (R480 노트북) (0) | 2013.03.16 |
[리눅스] 이메일 설정 (0) | 2013.01.02 |
[리눅스] vsftpd 서버 설정 (0) | 2012.04.05 |
[리눅스] vi 환경설정 (1) | 2011.01.17 |