Results 1 to 3 of 3

Thread: What is cron.hourly, etc. directories and run-parts lines in crontab for?

  1. #1
    Join Date
    May 2014
    Beans
    30

    What is cron.hourly, etc. directories and run-parts lines in crontab for?

    In the etc directory I have:
    user:~$ ls /etc/ | grep cron.
    cron.daily
    cron.hourly
    cron.monthly
    cron.weekly
    And in the crontab file I have:
    user:~$ cat /etc/crontab
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

    # m h dom mon dow user command
    17 * * * * root cd / && run-parts --report /etc/cron.hourly
    25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    Can anyone please explain what these directories and crontab entries are actually doing. There is nothing in the cron.daily directory, so why is it even there? Google is usually my friend, but is silent on this topic. Or more likely, I just don't know how to ask the question correctly. Hope you can help.

    Thanks.

  2. #2
    Join Date
    Jul 2008
    Location
    The Left Coast of the USA
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: What is cron.hourly, etc. directories and run-parts lines in crontab for?

    They contain files that cause certain routine tasks to be executed periodically.

    You can also place your own scripts in any of those directories to have the script run at that interval. I have one in .daily, for instance, that trims my SSD.

    Don't remove them. Directories in your /etc directory are system files you don't want to mess with.
    Please read The Forum Rules and The Forum Posting Guidelines

    A thing discovered and kept to oneself must be discovered time and again by others. A thing discovered and shared with others need be discovered only the once.
    This universe is crazy. I'm going back to my own.

  3. #3
    Join Date
    May 2014
    Beans
    30

    Re: What is cron.hourly, etc. directories and run-parts lines in crontab for?

    This:
    17 * * * * root cd / && run-parts --report /etc/cron.hourly
    means:
    Every 17th minute of the hour, as user "root" change directory to "/" (meaning root directory) and ( "&&" ) using function called "run-parts" with option "--report" execute any script (file ending with ".sh") in directory "/etc/cron.hourly".

    Do I have that right?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •