Linux Scheduled Tasks Crontab notes and summaries (3) Crontab configuration file

Source: Internet
Author: User

"Global (System) configuration file"

/etc/crontab

Linux main configuration files are in the ETC directory.

CD/etcls cron*

Vim crontab

Access to CRON.D (service)

CD CRON.D

Use the cat command to view the Sysstat file (the Cat command is a text output command under Linux, usually for viewing the contents of a file)

Cat Sysstat

You'll find that the content looks similar to what you crontab-l.

When the crontab loads the configuration file, it will load the configuration information in the CRON.D file into the scheduled task of the root user, and if you use the CRONTAB-E command to edit it, it will actually destroy the contents of the original file configuration, so it is generally not willing to use Crontab-e's. If you edit the file directly: Vim Sysstat, and then use Crontab-l, you will find that the editing file will not be loaded directly (crontab-l view of the content will not change), you can crontab Sysstat by the Way (crontab followed by a file of the way) to load the file, and then use Crontab-l view, at this time the contents of the file is covered with the original crontab-l inside all the things, so in the crontab behind with a file this form of import should be very careful, because CRONTAB-E The contents of the polygon will be overwritten by the file. To make a scheduled task not be lost, usually not using CRONTAB-E, but in a file to add, and then load, so when the system restarts, these files will be automatically loaded into the scheduled task list, note that this method is loaded in the root user mode.

When using the LS cron* command, there will be a CRON.D directory, which is the directory of the configuration file. It is very similar to the crontab file under the Sysstat and etc directory,

Contab cannot edit scheduled tasks inside a system-level configuration file (for example, create a new scheduled task file under CRON.D crontst, which writes */1 * * * Dee echo "file in/ect/cron.d/crontst*** *, then: wq! save exit, you can use tail-f/var/log/cron to monitor, you can find out the execution of this scheduled task, but use crontab-l or CRONTAB-E cannot list this scheduled task).

Added

First Use

Crontab-l

Re-use

CAT/var/spool/cron/root

You will find the output of the two commands as follows:

In fact crontab operation, the operation is/var/spool/cron/root this file.

can use

LS/var

View the scheduled tasks for all users.

"Root configuration File"

Only the Root user will load the content into the scheduled task table

Linux Scheduled Tasks Crontab notes and summaries (3) Crontab configuration file

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.