Both Cron and Anacron are daemons used for job scheduling .Cron jobs can run as often as every minute. However, the utility assumes that the system is running continuously and
if the system is not up at the time when a job is scheduled, the job is
not executed.
On the other hand, Anacron remembers the scheduled jobs if the system is
not running at the time when the job is scheduled. The job is then
exectuted as soon as the system is up. However, Anacron can only run a
job once a day.The cron and anacron jobs are both picked by the
crond
service. Just like how cron has /etc/crontab, anacron has /etc/anacrontab.
/etc/anacrontab file has the anacron jobs mentioned in the following format.
-----------------------------------------------------------------------------------
period in days delay in minutes job-identifier command
------------------------------------------------------------------------------------
period in days —
frequency of job execution in days
The property value can be defined as
an integer or a macro (@daily,
@weekly, @monthly), where @daily denotes the same value as integer 1, @weekly the same as 7, and @monthly specifies that the job is run once a month regardless of the
length of the month.
delay in minutes
— number of minutes anacron waits before executing the job
The property value is defined as an
integer. If the value is set to 0, no delay applies.
job-identifier
— unique name referring to a particular job used in the log files
command — command
to be executed
The command can be either a command
such as ls /proc >> /tmp/proc or a command which executes a custom script.
No comments:
Post a Comment