Linux crontab command and linuxcrontab command

Source: Internet
Author: User

Linux crontab command and linuxcrontab command

I. Introduction

Crond is a daemon in linux that is used to periodically execute a task or wait for processing some events. It is similar to a scheduled task in windows. After the operating system is installed, by default, the service tool is installed and the crond process is automatically started. The crond Process regularly checks whether there are tasks to be executed every minute. If there are tasks to be executed, the task is automatically executed.

In Linux, task scheduling is divided into two types: System Task Scheduling and user task scheduling. There is a crontab file under the/etc directory, which is the configuration file for system task scheduling. Task Scheduling: You can use the crontab tool to customize your scheduled tasks. All user-defined crontab files are saved in the/var/spool/cron directory. The file name is the same as the user name.


Ii. Syntax

usage:    crontab [-u user] file    crontab [-u user] [ -e | -l | -r ]        (default operation is replace, per 1003.2)    -e    (edit user's crontab)    -l    (list user's crontab)    -r    (delete user's crontab)    -i    (prompt before deleting user's crontab)    -s    (selinux context)

Description format of each task in the/etc/crontab file:

minute hour day month dayofweek command


Minute-integer hour from 0 to 59-integer day from 0 to 23-integer from 1 to 31 (must be the valid date of the specified month) month-an integer from 1 to 12 (or a month abbreviated as Jan or Feb) dayofweek-an integer from 0 to 7, 0 or 7 is used to describe Sunday (or abbreviated as Sun or Mon) command-command to be executed (as ls/proc>/tmp/proc or command to execute custom scripts)

Command can contain root and run-parts. The meaning is as follows:

"Root" indicates running run-parts as the root user. It indicates that a folder is followed by all the scripts in the folder.


Iii. Instances



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