Crontab let Linux execute shell scripts at timed intervals

Source: Internet
Author: User
Tags learn php

Use crontab you can perform a specified time in the Shell script or a series of Linux command. For example, the system administrator schedules a backup task to run every day

Entry

# crontab–e

This enables the edit mode to open the personal crontab configuration file, and then add this line:

0 0 * * */home/linrui/xxxxxxxx.sh

this will be running in the wee hours of the day of the specified . SH file

Cron Description of each item

Below are crontab format of the file:

{minute} {Hour} {Day-of-month} {Month} {Day-of-week} {Full-path-to-shell-script}

o minute: interval is 0 – -

o Hour: interval is 0 – at

o Day-of-month: interval is 0 – to

o month: interval is 1 – 1 1 month . Yes month

o Day-of-week: interval is 0 – 7. Sunday can be 0 or 7.

Crontab Example

1 , in early morning 00:01 Run

1 0 * * */home/linrui/xxxx.sh

2 , every weekday 23:59 are backed up by a backup job.

* * 1,2,3,4,5/home/linrui/xxxx.sh

or the following:

* * 1-5/home/linrui/xxxx.sh

3 , run commands every minute

*/1 * * * */home/linrui/xxxx.sh

4 , each month's 1 number 14:10 Run

1 * */home/linrui/xxxx.sh

Crontab options for Commands

Below are crontab the effective Options :

crontab – e: Modify crontab file . If the file does not exist, it is created automatically.

crontab – L: Show crontab file.

Crontab-r: Delete crontab file.

Crontab-ir: Delete crontab The user is alerted before the file.

Free pick upBrother LianITEducationOriginalLinuxMaintenance EngineerVideo/elaborateLinuxtutorials, more information on the official website customer service:http://www.lampbrother.net/linux/

learn PHP, Linux, HTML5, UI, Android and other video tutorials (Courseware + notes + video)! Contact Q2430675018

Linux Welcome to join the Exchange group Group number: 478068715


Crontab let Linux execute shell scripts at timed intervals

Related Article

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.