/etc/crontab 파일을 보면 아래와 같이 매시간/매일/매주/매달 실행이 되는
명령들을 각각의 디렉토리에 모아놓고
crond 데몬을 이용해서 실행시키고 있다.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
사용자가 설정한 cron 이 실행되도록 할려면 위의 디렉토리에 스크립트를 넣어놓아도 되지만
관리의 편리함을 위해서 /root/cron 이라는 디렉토리를 만들고
하위 디렉토리로 hourly, daily, weekly, monthly 라는 디렉토리를 만든 다음에
/etc/crontab파일에 아래와 같이 추가한다.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
# modified by Jang Ki-chang
01 * * * * root run-parts /root/cron/hourly
10 1 * * * root run-parts /root/cron/daily
22 1 * * 0 root run-parts /root/cron/weekly
50 1 1 * * root run-parts /root/cron/monthly
추가가 끝나면
> service crond restart
라는 명령을 실행시켜 crond 데몬을 재실행시킨다.
그러면 사용자의 cron 이 실행된다.


0