Crontab Scheduled Tasks

Source: Internet
Author: User

Timed Run command scripts in Linux

Crontab

The crontab command is used to install, delete, or list tables used to drive the cron daemon, and the user places the sequence of commands that need to be executed in the crontab file for execution.
Each user can have their own crontab file,/var/spool/cron under the crontab file can not be directly created or directly modified, the Crontab file is created by the CRONTAB-E command

In the crontab file, how to enter the command and time to execute, each row in the file contains six fields, the first five of which are the time the specified command was executed, and the last field is the command to be executed.
Spaces or tabs are used to separate each field. The format is as follows:
Minutehour day-of-month month-of-year Day-of-week commands
Legal value 00-59 00-23 01-31 01-12 0-6 (0 is Sunday)

In addition to the numbers there are a few special symbols that are "*", "/" and "-", ",", * representing all the values within the range of numbers

"/" stands for each meaning, "/5" means every 5 units, "-" stands for a number of discrete numbers from a certain number to a digit, ",".

-L Displays the current crontab on the standard output.
-R Deletes the current crontab file.

-e Edit the current crontab file using the editor referred to in visual or editor environment variables. When you finish editing, the edited file is automatically installed.

Example:
Six points per day:
0 6 * * command
Every two hours:
0 */2 * * command
11 o'clock to 8 a.m. every two hours and eight a.m..
0 23-7/2,8 * * command
Every month, number 4th and Monday to Sunday, three a.m., 11.
0 4 * 1-3 command
January 1 morning, 4.
0 4 1 1 * command
Every day 4 o'clock in the afternoon, 5, 6 points of 5 min, min, min, min, min, min, when the execution of orders.
5,15,25,35,45,55 16,17,18 * * command

Execute this command with crontab

Crontab Scheduled Tasks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.