UNIX crontab usage

Source: Internet
Author: User

Crontab is a convenient way to regularly (cyclically) execute a task on Unix/Linux systems.Program

Basic usage:
1. crontab-l
List the current crontab task
2. crontab-d
Delete the current crontab task
3. crontab-E (crontab-r above solaris5.8)
Edit a crontab task and ctrl_d ends.
4. crontab filename
Use filename as the crontab task list file and load it

Crontab file format:
Rows in the crontab file are composed of six fields. Different fields are separated by spaces or the tab key. The first five fields specify the time when the command will be run.
Minutes (0-59)
Hour (0-23)
Date (1-31)
Month (1-12)
Day of the week (0-6, 0 indicates Sunday)
The 6th fields are strings to be executed at the appropriate time

Example:
# Min hour day month dayofweek command  
#06:10 every morning  
10 6 **** date  
# Every two hours  
0 */2 *** date (Solaris 5.8 does not seem to support this method)
# Every two hours from PM to am, am  
0 23-7/2, 8 **** date 
# Am on the 4th day of each month and from Monday to Wednesday of each week  
0 11 4 * Mon-wed date  
# A.m. of July  
0 4 1 Jan * Date

Note: When Using crontab, the environment variables that can be accessed in the running script may not be consistent with those in the current test environment, it is safer to set the environment variable (export) in the running script program)

 

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.