Linux 자동 스케줄링 예제
crond 설치 방법
yum -y install cronie systemctl start crond systemctl enable crond systemctl status crond
crontab 활용
natasha 사용자가 매일 2분 간격으로 아래 명령을 실행하도록 설정합니다.
logger RH199 exam
풀이
# systemctl is-enabled crond # systemctl status crond # crontab -u natasha -e */2 * * * * logger 'RH199 exam'(입력) # crontab -u natasha -l */2 * * * * logger 'RH199 exam' # tail -f /var/log/messages # crontab -u natasha -e # crontab -u natasha -l
crontab daemon 실행 및 enabled 설정 후 -u 옵션으로 natasha 유저 계정에 -e로 수정을 하겠다.
*/2 * * * * logger 'RH199 exam'(띄어쓰기 중요) = 2분마다 logger 명령어에 RH199 exam 문장 출력
crontab
* | * | * | * | * |
---|---|---|---|---|
분 / Min | 시 / Hour | 일 / Day of Month | 월 / Month | 요일 Day of Weeks |