search
Homephp教程PHP开发Linux crontab scheduled tasks

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

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


Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),