80 likes | 183 Views
10. 주기적 프로세스. 석사 2 차 : 최재영. 목 차. cron : Schedule commands Format of crontab files Changing crontabs Some common use for cron 다양한 운영체제에 대한 특성. cron : Schedule commands. 주어진 일정한 시간에 명령을 실행하는 기능 cron daemon reads the configuration file, sh executes the commands 설정 파일 : ‘cron table’
E N D
10. 주기적 프로세스 석사 2차 : 최재영 운영체제론
목 차 • cron : Schedule commands • Format of crontab files • Changing crontabs • Some common use for cron • 다양한 운영체제에 대한 특성 운영체제론
cron : Schedule commands • 주어진 일정한 시간에 명령을 실행하는 기능 • cron daemon reads the configuration file, sh executes the commands • 설정 파일 : ‘cron table’ • BSD : /usr/lib/crontab or /etc/crontab • crontab 파일을 네트웍 전체에 전달, 특정 컴퓨터에 대한 명령어는 지역 crontab인 crontab.local • root 만이 조정, 사용될 사용자 이름에 대한 정보 포함, admin.’s tool • ATT : /var/spool/cron/crontabs directory • 사용자 당 하나의 crontab 파일이 있음 • cron daemon schemes • cron daemon checks periodically • reread crontab when explicit hangup • reread with crontab command 운영체제론
Format of crontab files • 필드 • minute hour day mouth weekday username command • 6개의 필드를 가지는 경우 username 생략 • 명령어가 실행되는 시간에 대한 정보 제공 • * : 어떤 값으로도 치환 • 단일 정수 : 일치되는 것 • 콤마 : 여러 개의 일치되는 시각 • - : 값의 범위 • username : 실행되는 계정 이름 (간접적으로 UID) • 예 • 30 2 * * 1 joe (cd /users/joe/project ; make) • 월요일 아침 2:30분에 /users/joe/project 디렉토리에 있는 make 실행 • 모든 결과는 소유자에게 메일로 보내짐 운영체제론
Changing crontabs • BSD • crontab 파일 직접 작성, hangup 신호로 cron 변경 알림 • ATT • crontab 명령 사용 • crontab filename : crontab으로서 filename을 설정 • crontab -e : 생성된 crontab의 복사본 가져와 편집기로 편집하고 다시 보냄 • crontab -l : 표준 출력으로 보여줌 • crontab -r : crontab 파일 제거 • crontab -elr username (for root) : 다른 사용자의 crontab 내용을 보거나 편집 • cron.allow : 사용 가능 목록 • cron.deny : 사용 불가능 목록 • 보안 : crontab 파일 허가권 관리 운영체제론
Some common use for cron • Processing Appointment Calendars • 중요한 날짜를 자동으로 알려주는 기능 • 사용자의 calendar 파일을 보고 관련된 목록을 뽑아 메일로 보내줌 • 30 1 * * * /usr/bin/calendar • Cleaning the Filesystem • 정크 파일 cron을 이용하여 밤에 디스크 공간 재설정 • UUCP Polling • 특정 시간에 다른 사이트의 호출을 초기화하는데 사용 • 그외 로그들을 요약하고 UUCP 스풀 영역을 청소 • 30장에서 다룸 운영체제론
Accounting • CPU 계정 정보 하루 한번씩 요약, 정리 • 각 계정의 총 사용량 계산 위해 매달 검토 • 28장 • Network Distribution of Configuration Files • 설정 파일 분산된 버전으로 관리하는 것이 편리 • 매일밤 rdisk나 expect 스크립트 사용하여 배포 운영체제론
다양한 운영체제에 대한 특성 • Solaris • ATT 형식의 cron /var/spool/cron/crontabs /etc/cron.d (설정 파일) • HP-UX • ATT /var/spool/cron/crontabs /usr/lib • IRIX • ATT /usr/spool/cron/crontabs /usr/lib/cron • SunOS • ATT /var/spool/cron/crontabs /var/spool/cron • OSF/1 • ATT /var/spool/cron/crontabs /var/adm/cron • BSDI • vixie-cron ATT와 비슷 운영체제론