Installation guide

Chapter 22. Automated Tasks 199
22.1.2. Controlling Access to Cron
The /etc/cron.allow and /etc/cron.deny files are used to restrict access to cron. The
format of both access control files is one username on each line. Whitespace is not permitted
in either file. The cron daemon (crond) does not have to be restarted if the access control files
are modified. The access control files are read each time a user tries to add or delete a cron
task.
The root user can always use cron, regardless of the user names listed in the access control
files.
If the file cron.allow exists, only users listed in it are allowed to use cron, and the at.deny
file is ignored.
If cron.allow does not exist, all users listed in cron.deny are not allowed to use cron.
22.1.3. Starting and Stopping the Service
To start the cron service, use the command /sbin/service crond start. To stop the ser-
vice, use the command /sbin/service crond stop. It is recommended that you start the
service at boot time. Refer to Chapter 8 for details on starting the cron service automatically
at boot time.
22.2. Anacron
Anacron is a task scheduler similar to cron except that it does not require the system to run
continuously. It can be used to run the daily, weekly, and monthly jobs usually run by cron.
To use the Anacron service, you must have the anacron RPM package installed and the
anacron service must be running. To determine if the package is installed, use the rpm -q
anacron command. To determine if the service is running, use the command /sbin/service
anacron status.
22.2.1. Configuring Anacron Tasks
Anacron tasks are listed in the configuration file /etc/anacrontab. Each line in the config-
uration file corresponds to a task and has the format:
period delay job-identifier command
period — frequency (in days) to execute the command
delay — delay time in minutes
job-identifier — description of the task, used in Anacron messages and as the name of
the job’s timestamp file, can contain any non-blank characters (except slashes).
command — command to execute
For each tasks, Anacron determines if the task has been executed within the period specified
in the period field of the configuration file. If it has not been executed within the given pe-
riod, Anacron executes the command specified in the command field after waiting the number
of minutes specified in the delay field.