Routine Job Schedule-crontab and anacrontab

Source: Internet
Author: User

Routine Job Schedule-crontab and anacrontab 1. Syntax: www.2cto.com [root @ www ~] # Crontab [-u username] [-l |-e |-r] Options and parameters:-u: only root can perform this task, that is, to help other users create/remove crontab work schedules;-e: Edit crontab work content-l: View crontab work content-r: Remove all crontab work content, to delete only one item, use-e to edit it. Meaning minute Hour Date month week instruction number range 0-59 0-23 1-31 1-12 0-7 (0 or 7, both represent 'sunday ') 2. special symbols in numbers: * any time, or meaning. For example, if the job to be issued is between and, it will be: 0 3, 6 *** command-time range/N' meaning of interval of n Units 3. obfuscation concept www.2cto.com:/usr/bin/crontab, the information in/etc/crontab and/var/spool/cron is scanned every minute. Crontab-e is a routine task of the user. After the task is created,/var/spool/cron/appears. vi/etc/crontab is a routine task of the system, for example, execute all executable scripts in the directory, such as 01 ***** root run-parts/etc/cron. hourly indicates that cron is executed every hour. all executable scripts in the hourly directory. 4. Security Control/etc/cron. allow: writes accounts that can use crontab into the file. users who are not in the file cannot use crontab;/etc/cron. deny: Write accounts that cannot use crontab into the file. If the account is not recorded in this file, you can use crontab. All are one account in one row,/etc/cron. allow ratio/etc/cron. deny should give priority to the above, and only one of the two files should be selected. Therefore, we recommend that you keep only one file to avoid affecting your judgment on settings! In general, the system defaults to keep/etc/cron. deny. You can write the user who does not want him to execute crontab to/etc/cron. deny. After you use the crontab command to create a Job Schedule, the job will be recorded in/var/spool/cron/and identified by an account. Do not use vi to directly edit the file because cron cannot be executed due to incorrect input syntax. 5. View logs:/var/log/cron, which contains multiple backups for one week. The current one is cron6, and the service is restarted after/etc/crontab, it may not be executed immediately. Restart the crond service at this time! '/Etc/init. d/crond restart' 7. Note: The Week and day and month cannot coexist, and the "months and months" mode cannot be used. 8. anacron: Performs anacron immediately after the instance is started. It will detect the crontab task that should be executed but has not been executed during the downtime. After executing the task again, anacron will automatically stop because anacron will detect crontab tasks not performed by the system for one day, seven days, and one month. Generally, you can set it by default. Configuration File:/etc/anacrontab. For more information about the syntax, see other manuals. To determine whether anacron is automatically executed when it is started, you can issue the following commands: [root @ www ~] # Chkconfig -- list anacron

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.