Excuse me, where are the scripts under /etc/cron.daily/ of the centos system set to be executed regularly?

In CeontOS6, crond searches for configuration files in /etc/cron.d every minute. There is a 0hourly file in which 01 * * * * root run-parts /etc/cron.hourly is written. It runs the /etc/cron.hourly directory every 1 hour. There is an 0anacron file under this directory, so that the 0anacron file can be run every hour. 0anacron compares the current time with the timestamp in the file under the /var/spool/anacron directory according to the configuration in the /etc/anacrontab file, and runs the corresponding entry in /etc/anacrontab if necessary. This is why only cron.daily, cron.weekly and cron.monthly are defined in the /etc/anacrontab file, but not cron.hourly, because cron.daily, cron.weekly and cron.monthly are actually adjusted by cron.hourly Got up.
0anacron running every hour only responsible for timestamp comparison, if the current date and the date of the last run anacron does not match, indicating the system down too, will start anacron this
support program, and then configure the anacron according to / etc / anacrontab further Judge, and then run the unfinished tasks in cron.daily, cron.weekly and cron.monthly.
So does anacrontab ignore hourly tasks? ?

What is the execution process in real time? ? Is there a great god to answer? ?

For details, please refer to this article: http://c.biancheng.net/view/1095.html

The timed tasks in the /etc/cron.{daily,weekly,monthly} directory of the original CentOS version will be called by cron and anacron at the same time, so it is very easy to repeat the same timed task. Therefore, in CentOS 6.x, the timed tasks in the /etc/cron.{daily,weekly,monthly} directory will only be called by anacron, thus ensuring that these timed tasks will only be executed once a day, every week, or every month , And will not be repeated.

The scripts in the /etc/cron.{daily, weekly, monthly} directory are called by anacron in current Linux and no longer rely on cron services. However, anacron does not need to set redundant configuration, we only need to put the scripts that need to be executed regularly into the /etc/cron.{daily, weekly, monthly} directory, and it will be executed every day, every week or every month, and no longer Need to start the anacron service. If you need to modify it, you only need to modify the /etc/anacrontab configuration file.

Guess you like

Origin blog.csdn.net/ichen820/article/details/115068934