Quantcast
Channel: はるはる。の開発日記 » CentOS
Viewing all articles
Browse latest Browse all 10

CentOS 6.5 の cron.dairy 実行時刻を変更する

$
0
0

CentOS 5.x では /etc/crontab で cron.dairy などの実行時刻が設定されていました。

# cat /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

CentOS 6.x で見てみると設定がありません。
CentOS 6.x では、/etc/anacrontab で指定されています。

# cat /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=240
# 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 は各 cron の開始時間で 03時~22時の間に開始します。
RANDOM_DELAY は各 cron を実行するタイミングをランダムで遅らせる時間(分)が指定されています。

ランダムに関しては、ゲストOSが重ならないようにするためのものですが、仮想化していない状況ではディレイが長過ぎます。
また、実行時間の範囲も広すぎるので以下のように設定しました。
RANDOM_DELAY=30
START_HOURS_RANGE=7-12

他にも、CentOS 5.x の方法に戻すやり方もありますが、当方はこれで十分でした。


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images