On a Linux system, the cron
daemon is responsible for running periodic tasks according to a schedule specified in configuration files called "crontabs". The cron
daemon reads these crontabs and executes the tasks they contain at the specified times.
There are several predefined crontabs on a typical Linux system, including cron.daily
, cron.weekly
, and cron.monthly
. These crontabs are located in the /etc/cron.d
directory and contain tasks that are intended to be run on a daily, weekly, or monthly basis, respectively.
The exact time at which tasks in cron.daily
, cron.weekly
, and cron.monthly
are run depends on the configuration of the system. On most systems, these tasks are run at a specific time every day, week, or month, as specified in the crontab.
For example, the cron.daily
crontab might contain a line like this:
0 4 * * * root run-parts /etc/cron.dailySource:www.lautturi.com
This line specifies that the run-parts
command should be run every day at 4:00 AM (using the 24-hour clock), and it will execute all the scripts in the /etc/cron.daily
directory.
Similarly, the cron.weekly
crontab might contain a line like this:
0 4 * * 0 root run-parts /etc/cron.weekly
This line specifies that the run-parts
command should be run every week on Sunday at 4:00 AM, and it will execute all the scripts in the /etc/cron.weekly
directory.
The cron.monthly
crontab might contain a line like this:
0 4 1 * * root run-parts /etc/cron.monthly
This line specifies that the run-parts
command should be run every month on the first day at 4:00 AM, and it will execute all the scripts in the /etc/cron.monthly
directory.
You can use the crontab -e
command to edit the crontabs on your system, including cron.daily
, cron.weekly
, and cron.monthly
. You can also create your own custom crontabs if you need to schedule tasks that don't fit into the predefined categories.