Scheduled tasks under linux – periodic scheduled tasks – linux operation and maintenance
The at command has been introduced in previous articles, which is used to set a scheduled task that is executed only once. Today, let’s take a look at the scheduled tasks that are executed periodically. In work, periodic scheduled tasks are often used, such as scheduled backup of system files, scheduled backup of database files, processing orders that have not been paid for a long time, and so on. Users set periodic crontab General users who want to set periodic scheduled tasks need to use the command crontab. Like at, crontab also has black and white lists, and the configuration files for them are – /etc/cron.deny, /etc/cron.allow. When the user sets a scheduled task, the task will be recorded in the /var/spool/cron directory as a text file. # ll /var/spool/cron/ total 4 -rw——- 1 root root 98 Jul 28 03:58 root About crontab, we only need to remember two commands crontab -e set scheduled tasks crontab -l view scheduled tasks The format for setting a scheduled task is as follows: Basic format: time-sharing date month week command Value range: [0-59] [0-23] [1-31] [1-12] [0-7] In addition, we also need to remember a few special characters Meaning: * means any time…