unix

How are the daily, weekly, and monthly cron jobs scheduled in RHEL6 and CentOS 6?

In CentOS 6.x, the way that the default system maintenance cronjobs are scheduled has been changed. These cron jobs are responsible for rotating logs and indexing files on the filesystem.

In CentOS/RHEL 5.x system maintenance cronjobs were scheduled using the /etc/crontab file. This is no longer the case in CentOS 6.x as /etc/crontab is empty by default and anacron is installed by default and is responsible for the maintenance cron jobs.

Anacron is run by crond via the 0anacron file in /etc/cron.hourly and it does not run as it’s own daemon. It is configured using /etc/anacrontab and executes the commands in the /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly directories.

Here’s a sample file from CentOS 6.0:

# /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

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top