Linux under Crontab detailed

Source: Internet
Author: User

Overview

Task scheduling: Refers to a particular command or program that the system executes at a certain time

Task Scheduling Classification:

-System work: Some important work must be performed periodically, such as virus scanning, etc.

-Individual users work: Individual users may want to perform certain programs

Task Dispatch commands

Set Task Scheduler file:/etc/crontab

Set up personal Task Scheduler, execute crontab ‐e Command, then enter task to dispatch file

"Case"5 * * * * ls ‐l/etc/>/tmp/to.txt, meaning to say five minutes per hour to execute the ls command

Rules for scheduling files

Field name

Description

Range

Minutes

The number of minutes per hour to execute

0-59

Hours

The first hours of the day are executed

0-23

Date

Day of the Month execution

1-31

Calendar

The month ordinal of the year is executed

1-12

Week

Day of the Week execution

0-6

Using Task scheduling

-Set Tasks

-Crontab‐e

-Perform date >/home/mydate2 at certain intervals

-Want to go to the day of the morning 2:xx to perform date >>/home/mydate2, you can crontab ‐e added:0 2 * * * Date >>/home/mydate2

-Wish to execute every minute: Add in crontab ‐e :* * * * *date >>/home/mydate2

-How to schedule multiple tasks

- write multiple commands directly in Crontab ‐e (not recommended)

-Can put all tasks, write to an executable file (Shell programming)

-Terminate task scheduling

-Crontab‐r: Terminating task scheduling

-Crontab‐l: Lists which tasks are currently scheduled

Linux under Crontab detailed

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.