2

How does anacron start in Centos7 ?

/etc/crontab shows empty

  • anacron.conf contains cron.daily folder
  • cron.daily folder contains logrotate config file
  • logrotates are working perfectly

My question : I cannot find any relation between cron and anacron then how does anacron start in centos7 .

2

It's run from cron, of course, using the script in /etc/cron.hourly/0anacron.

Scripts in /etc/cron.hourly are run hourly by the job in /etc/cron.d/0hourly.

  • thanks, But /etc/crontab is empty and cron.hourly ! not include – Jobish Jose Mar 14 '18 at 15:17
  • If it really was not there, then anacron wouldn't run. – Michael Hampton Mar 14 '18 at 15:49
  • Yes it was not there ... cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root – Jobish Jose Mar 14 '18 at 16:07
  • What are you talking about? I didn't say anything about /etc/crontab. – Michael Hampton Mar 14 '18 at 16:18
  • cron.hourly not include /etc/crontab then how cron.hourly and 0anacron work .. sorry for my poor English – Jobish Jose Mar 14 '18 at 16:23
0

anacron and cron are similar but different tools. They are both daemons, and normally you will install one or the other. They will each handle their own scheduled workload. If both are installed, neither should ever execute the others commands if both are installed.

cron is the older tool and designed for systems that are always on (servers). Newer versions will execute commands listed in /etc/crontab. It is is possible to create crontab entries to run the /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly workload if anacron is not installed.

anacron is a newer tool better suited for systems that are not always on. It uses the file /etc/anacrontab to control what should be run.

  • Unlike cron, anacron is not a daemon. It's a binary, which on CentOS gets executed hourly by ... cron. – DKroot Oct 27 '18 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.