Tasks In /etc/cron.daily On CentOS 7?

Home » CentOS » Tasks In /etc/cron.daily On CentOS 7?
CentOS 3 Comments

Hi,

I just configured SquidAnalyzer, a nifty little network statistics tool that I’m using mainly in school networks to monitor network usage.

I want to run the ‘/usr/bin/squid-analyzer’ script once a day. I took a peek in /etc/cron.daily, and the package already installed an
/etc/cron.daily/0squidanalyzer script.

I wanted to know at what time CentOS ran the cron.daily scripts, so I
typed crontab -l, but there was only “no cronjobs defined for root”.

Here’s how things look on a public Slackware64 14.0 server I administrate:

# crontab -l

# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null

How is this handled on CentOS 7?

Cheers,

Niki

Microlinux – Solutions informatiques 100% Linux et logiciels libres
7, place de l’église – 30730 Montpezat Web : http://www.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32

3 thoughts on - Tasks In /etc/cron.daily On CentOS 7?

  • In CentOS 5 this is configured in /etc/crontab

    From CentOS 6 onward, cron.hourly comes out of /etc/cron.d/0hourly and the rest are configured in /etc/anacrontab

    -Thomas

  • Hi Nicki,

    I’m new to CentOS, and came from Slackware servers too. I recently installed 2 servers with CentOS 7 and was unaware of /etc/anacrontab. I saw there was an /etc/crontab file and entered a few executable bash scripts in there. My logs confirm it’s up and functional.

    /etc/crontab :

    SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root

    # For details see man 4 crontabs

    # Example of job definition:
    # .—————- minute (0 – 59)
    # | .————- hour (0 – 23)
    # | | .———- day of month (1 – 31)
    # | | | .——- month (1 – 12) OR jan,feb,mar,apr …
    # | | | | .—- day of week (0 – 6) (Sunday=0 or 7) OR
    sun,mon,tue,wed,thu,fri,sat
    # | | | | |
    # * * * * * user-name command to be executed

    20 6 * * * root /root/RTCSS
    20 12 * * * root /root/RTCSS
    20 18 * * * root /root/RTCSS
    10 23 * * * root /root/a1-precise

    CentOS mailing list CentOS@CentOS.org http://lists.CentOS.org/mailman/listinfo/CentOS

  • CentOS / RHEL 7 use anacron for this

    [root@server~]# cat /etc/anacrontab
    # /etc/anacrontab: configuration file for anacron

    # See anacron(8) and anacrontab(5) for details.

    SHELL=/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root
    # the maximal random delay added to the base delay of the jobs RANDOM_DELAYE
    # 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

    Tris

    *************************************************************
    This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify postmaster@bgfl.org

    The views expressed within this email are those of the individual, and not necessarily those of the organisation
    *************************************************************