Sinsing analysis of Anacron in Linux

Source: Internet
Author: User

If our Linux host is 24 full-day in the boot state, we only need ATD and crond these two services, if our server is not a 24-hour uninterrupted start, then we need anacron help.

Anacron can not replace Cron to run a task, but in days or immediately after the start of the Anacron action, it will detect the downtime should be carried out but not the crontab task, and run the task once again, Anacron will automatically stop.

Anacron will detect non-crontab tasks in the system in a day, seven-day, one-month cycle, so it is very helpful for some special use environments. Anacron will go to analyze the time and time recorded in the current record of the last run Anacron time, the two thicker if found to be different, that is, at some point did not crontab, then Anacron will start to execute the crontab is not running. So Anacron also heard crontab to run, so Anacron run time usually by two, one is running during system startup, one is written to the crontab schedule, so that in a specific time to analyze the system does not work crontab. We can use ll/etc/cron*/*ana* to view the detection time of the Anacron. But when we carefully analyze the file, we find that it mainly executes the Anacron command.

The syntax of the Anacron command is as follows:

(1)-s start continuous operation of the work, will be a time to record when the data to determine whether or not.

(2)-F is enforced without judging the time stamp of the time log file.

(3)-n immediately perform an unfinished task without delaying the wait time.

(4)-U only upgrade time record when the timestamp, do not do any work.

The Anacron configuration file is/etc/anacrontab, and many of its contents are stored in/var/spool/anacron.

When Anacron releases Anacron-s cron.daily, it will have the following steps:

(1) The number of days from/etc/anacrontab analysis to cron.daily This job name is one day.

(2) The timestamp of the most recent run Anacron was taken out by/var/spool/anacron/cron.daily.

(3) Compare the time stamp taken with the current timestamp, and if the difference is more than one day, prepare the command.

(4) If the order is ready, the delay will be 65 minutes according to the/etc/anacrontab configuration.

(5) After the delay time, start to run the subsequent command, that is, run-parts/etc/cron.daily this sequence of commands.

(6) After the operation is complete, the Anacron program ends.

Sinsing analysis of Anacron in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.