Presentation is loading. Please wait.

Presentation is loading. Please wait.

Crontab.

Similar presentations


Presentation on theme: "Crontab."— Presentation transcript:

1 crontab

2 -l crontab 파일의 내용을 화면에 출력할 때 사용. -r crontab 파일을 삭제할 때 사용.
Crontab option -e crontab 파일을 편집할 때 사용. -l crontab 파일의 내용을 화면에 출력할 때 사용. -r crontab 파일을 삭제할 때 사용. cron 명령은 지정된 날짜와 시간에 일정 작업을 주기적으로 수행하기 위해 사용되며 각 사용자 별로 /var/spool/cron/crontabs directory에 사용자 ID와 같은 이름의 crontab file을 만들어 cron job을 지정할 수 있다. cron 명령은 system이 부팅되면서 /etc/rc2.d/S75cron script에 의해서 daemon 형태로 수행된다. Crontab을 사용하면 SMS와 유사한 기능을 수행할 수 있으며 관리자가 작업시간을 선택할 수 있기 때문에 편리하다. 주로 backup을 수행할 때 많이 사용된다.

3 Minutes Hours Date Month Day-of-Week command Minutes = [0부터 59까지]
crontab 1. Crontab 사용법 1). Crontab의 정의 Crontab 명령형식 Minutes Hours Date Month Day-of-Week command Minutes = [0부터 59까지] Hours = [0부터 23까지] Date = [1부터 31까지] Month = [1부터 12까지] Day-of-Week = [0부터 7까지] (0과 7)=일요일, 1=월요일, 2=화요일, 3=수요일, 4=목요일, 5=금요일, 6=토요일, command = 실행하고자 하는 명령 command를 제외한 모든 필드에 와일드 카드 문자(*)를 사용할 수 있고, field에 - 기호를 사용해서 범위를 지정할 수 있다. 30 1 * 2,4,6,8,10, /usr/bin/wall /var/tmp/message

4 /etc/cron.d/cron.allow file이 존재하는 경우, 그 file 안에 지정되지 않은 사용자
crontab 1. Crontab 사용법 1). Crontab의 정의 Crontab 사용권한 /etc/cron.d/cron.allow file이나 /etc/cron.d/cron.deny file을 이용하여 시스템 관리자는 각 사용자 별로 crontab 화일에 대한 access 권한을 제한 할 수 있다. crontab을 access 할 수 있는 사용자 /etc/cron.d/cron.allow file이 존재하는 경우, 그 화일 안에 지정된 사용자 2. /etc/cron.d/cron.allow file이 없는 경우, /etc/cron.d/cron.deny file안에 지정되지 않은 사용자 -crontab을 access 할 수 없는 사용자 /etc/cron.d/cron.allow file이 존재하는 경우, 그 file 안에 지정되지 않은 사용자 2. /etc/cron.d/cron.allow file이 없는 경우, /etc/cron.d/cron.deny file에 지정된 사용자 3. /etc/cron.d/cron.allow와 /etc/cron.d/cron.deny file이 모두 없는 경우, root를 제외한 모든 사용자

5 OS가 설치되면 기본적으로 /etc/cron.d/cron.deny이 생성되고 그 안에 아래의 사용자들이 지정된다. daemon
crontab 1. Crontab 사용법 1). Crontab의 정의 Crontab 사용권한 OS가 설치되면 기본적으로 /etc/cron.d/cron.deny이 생성되고 그 안에 아래의 사용자들이 지정된다. daemon bin smtpd nuucp listen nobody noaccess /etc/cron.d/cron.allow와 /etc/cron.d/cron.deny file에 사용자를 지정할 때에는 위와 같이 한 줄에 한 명씩 사용자를 지정한다.

6 crontab 1. Crontab 사용법 1). Crontab의 정의 Crontab 사용권한 vi와 같은 텍스트 편집기로 직접 crontab 파일을 편집하면 안된다. crontab -e 명령을 사용하면 vi를 호출한 다음 변경된 내용을 cron에 알린다. crontab -e 명령을 사용해서 crontab 항목을 모두 삭제했지만 crontab -l 명령을 실행하면 삭제한 항목이 나온다. crontab 파일을 모두 삭제하려면 crontab -r 명령을 사용해야 한다. crontab -e 명령은 빈 파일을 처리하지 못하기 때문에 변경된 내용을 업데이트하지 못한다. 특정 편집기를 사용은? 환경 변수 EDITOR를 (특정 편집기 이름)으로 설정하면 된다. 하지만 일반적으로 vi 이외에 다른 편집기(ed라는 편집기가 있다.)를 거의 사용하지 않는다.

7 # EDITOR=vi (editor 설정) # export=EDITOR # vi /etc/cron.d/cron.allow
crontab 1. Crontab 사용법 1). Crontab의 정의 Crontab 기타 설정 # EDITOR=vi  (editor 설정) # export=EDITOR # vi /etc/cron.d/cron.allow (crontab 명령어가 수행되지 않을 시 user명을 추가해준다.) root user명 # crontab -e (crontab 생성) # crontab -e user명  (user명에 해당하는 crontab 생성) 30 17 * * 5 /usr/bin/banner "Time to go!" > /dev/console :wq  (/var/spool/cron/crontabs/user_name 에 저장된다.) # crontab -l (리스트 확인) # crontab -l user명  (user명에 해당하는 리스트 확인) # crontab -r user명 (crontab 삭제)


Download ppt "Crontab."

Similar presentations


Ads by Google