Linux – makewhatis and logrotate cron job schedule

centoscronlinux

In /etc/cron.daily/,

  • logrotate*
  • makewhatis.cron*

I understand that above are daily cron jobs. How to display the time set for logrotate and makewhatis.cron?

Its not listed when I tried this script:

for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done

Best Answer

Check /etc/anacrontab

Cron runs anacron, which runs then cron.daily/weekly/monthly...

If you have the default files, you'll see something like:

# /etc/anacrontab: configuration file for anacron

# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

Basically, this means that the jobs in /etc/cron.daily/ will run sequentially beginning at 3:05am + a random delay of up-to-45 minutes.

For example, you can see when makewhatis ran in the past by searching your logs:

# grep makewhatis /var/log/cron

/var/log/cron:Jan 25 03:35:20 xt run-parts(/etc/cron.daily)[21432]: starting makewhatis.cron
/var/log/cron:Jan 25 03:35:21 xt run-parts(/etc/cron.daily)[21776]: finished makewhatis.cron
/var/log/cron:Jan 26 03:39:21 xt run-parts(/etc/cron.daily)[54618]: starting makewhatis.cron
/var/log/cron:Jan 26 03:39:33 xt run-parts(/etc/cron.daily)[58997]: finished makewhatis.cron
/var/log/cron:Jan 27 03:40:15 xt run-parts(/etc/cron.daily)[56366]: starting makewhatis.cron
/var/log/cron:Jan 27 03:40:16 xt run-parts(/etc/cron.daily)[56710]: finished makewhatis.cron