CentOS에서 보면
/etc/cron.daily
/etc/cron.hourly
/etc/cron.weekly
/etc/cron.monthly
디렉토리가 존재한다. 해당 디렉토리에서 shell script을 넣어두면 해당 주기별로 실행한다.
ex) /etc/cron.daily/delete_log
#!/bin/bash
find /var/log -mtime +3 -exec rm {} \;
그러면 실제적으로 어느 시간에 해당 cron이 도는지는 anacrontab을 통해서 알수 있다.
/etc/anacrontab 을 보면
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
시작 시간은 START_HOURS_RANGE에서 처럼 3~22시 사이에 발생함
RANDOM_DELAY는 각 스크립트가 가진 delay time에서 0~RANDOM_DELAY 값을 더한 후 실행된다.
anacron 에 대한 설명
http://www.thegeekstuff.com/2011/05/anacron-examples/