Linux Scheduled Tasks

Source: Internet
Author: User

One-time Scheduled tasks

At the specified time to execute a specific command

Usage: at [TIME]

Example:

At 9:00am #指定在当天早上9点执行计划任务

At > Cp/etc/passwd/tmp #计划任务内容

At > <EOT> #输入完成后, End by Ctrl+d

At-l List Current Scheduled tasks

Recurring Scheduled Tasks--crontab

Crontab-l List Scheduled Tasks

#service Crond Restart Restart

A) Use to open the service first

#service crond Status

#chkconfig--list List system service status

#chkconfig--list | grep crond View Crond service startup status

b) Specify the content of the scheduled task

Crontab content Format

First column Second column Third column Fourth column Fifth Column Sixth column
Score of When Day Month Week Command
00~59 00~23 1~31 1~12 0~7 Cmd

Week: 0~7, 0 and 7 all indicate Sunday

, if time is the time period, you can

Use a horizontal bar (-) to denote a continuous period of time

Use a comma (,) to indicate a number of discontinuous times

Use an asterisk (*) to indicate all times

Use Division sign (/) to indicate the time interval

b) Specify the content of the scheduled task

* * * * * cmd

Example: Every Wednesday 2 o'clock in the morning backup/etc/passwd

0 2 * * 3 cp/etc/passwd/tmp

Example: 10th No. 25th per month, 1:5 A.M. Clear/tmp

5 1 10,25 * * rm-rf/tmp/*

Example: Performing time synchronization every 10 minutes

*/10 * * * * * * ntpdate time server IP

Example: 1-6 hours a day.

0 1-6 * * * *

c) Restart Crond service

#service Crond Restart

View Files Dynamically

Tail-f/tmp/date.log

Linux 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.