In Ubuntu, the/etc/crontabsudovi/etc/crontabcron service needs to read not only all files in/var/spool/cron once per minute, but also/etc/crontab once, therefore, we can use the cron service to configure this file. Crontab configuration is intended for a user, and editing/etc/crontab is a system task. The file format of this file is: SHEL
Ubuntu
Edit file/etc/crontab
Sudo vi/etc/crontab
The cron service not only reads all files in/var/spool/cron every minute, but also reads/etc/crontab once. Therefore, we can use the cron service to configure this file. Crontab configuration is intended for a user, and editing/etc/crontab is a system task. The file format of this file is:
SHELL =/bin/bash
PATH =/sbin:/bin:/usr/sbin:/usr/bin =
MAILTO = root // if an error occurs or data is output, the data is sent to this account as an email.
HOME = // path of the user running. The root directory is used here.
# Run-parts
01 *** root run-parts/etc/cron. hourly // execute scripts in/etc/cron. hourly as root every hour
02 4 *** root run-parts/etc/cron. daily // execute the script in/etc/cron. daily as the root user every day.
22 4 ** 0 root run-parts/etc/cron. weekly // execute scripts in/etc/cron. weekly as the root user every week.
42 4 1 ** root run-parts/etc/cron. monthly // execute the script in/etc/cron. monthly as the root user every month.
Note the "run-parts" parameter. If this parameter is removed, you can write a script name to run later, instead of the folder name.