cron の動作
普段、気にせずともあまり困ってないんだが、ふと整理してみたのでメモ。
CentOS release 6.4 で確認(バージョンによって結構、違いあるみたい)。
cron.daily、cron.weekly、cron.monthly は anacron で実行され、それ以外はcrondが実行してるぽい。
といっても、anacron は cron.hourly で実行されているという・・・
anacron の実行内容は /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
となっているせいか、cron.daily は毎日3時過ぎに実行されている。
また、RANDOM_DELAY と delay in minutes の設定があるせいか、3時間ちょうどではなく中途半端な時間に実行されている。
また、anacronで実行しているので、サーバ止めてた分も起動すると遡及して実行されるのか?これは未確認。