Home > php教程 > PHP开发 > body text

Linux crontab scheduled tasks

高洛峰
Release: 2016-11-15 14:40:21
Original
1408 people have browsed it

What is crontab?

The crontab command is the abbreviation of cron table. It is the configuration file of cron, also called the task list. We can find the relevant configuration files in the following directory

/var/spool/cron/: stores all user definitions to be executed regularly The task, the file name is consistent with the user name
/etc/crontab: Tasks to be performed periodically by the system
/etc/cron.d/: Directory used to store any crontab files or scripts to be executed
Other directories: /etc/ cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly, each represents the storage of tasks executed hourly, daily, weekly, and monthly

Usage of crontab

crontab [-u username]     //可选,省略则表示操作当前用户的crontab
        -e        //编辑crontab定时任务
        -l        //列出crontab里的内容
        -r        //删除crontab
Copy after login

crontab commands are composed of time and commands. The time is arranged in order by minutes, hours, days, months, and Fridays. The operators are:

*: any time
/:How often
-:Continuous time
,:Discontinuous time

Instance description

Execute the command every minute

* * * * * The command

is executed at the 10th and 30th minutes of every hour

10,30 * * * * Command

is executed every minute from 8 to 10 o'clock

* 8-10 * * * Command

is executed every 10 minutes on the 15th of every month

*/10 * 15 * * Order

is executed every Monday at 6:30

30 6 * * 1 Order


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template