Old boy Linux Crond scheduled tasks exercises

Source: Internet
Author: User

Linux Crond Scheduled Task exercises

Crond is a service or software that is used on a system to perform regular commands or to specify program tasks. strictly speaking,the Linux system has a lot of scheduled tasks, such as: At, Crontab, Anacron, where crontab This command is often used to perform periodic tasks in the actual work. For example, server time synchronization is done every five minutes. To execute crontab This command, you also need to start a service crond. So, let's practice the crontab.

First, according to the command to say the meaning of text:

1) 3,12 */bin/sh  / Scripts/oldboy. SH

This example, section a listed as 30 minutes second column 3 and 12 points, this timed task means the early morning 3 Dot and General Affairs 12 dots at half-time (i.e. daily 3:30 and 12:30) Execute/scripts/oldboy.sh script

2) */6 * * */bin/sh/scripts/oldboy.sh

in this example, the first column is 30, which represents 30 minutes, and the second column */6 represents every 6 hours, and this timed task means that every 6 hours (i.e. 6:30, 12:30, 18:30, 24:30) executes/scripts/oldboy.sh Script

3) 8-18/2 * * */bin/sh/scripts/oldboy.sh

in this example, the first column is 30, representing 30 minutes, and the second column 8-18/2 represents every 2 between 8 o'clock in the morning and 18 o'clock in the afternoon

hours, this timed task means that every 2 hours between 8 and 18 o'clock in the afternoon in the morning,/scripts/oldboy.sh scripts are executed

4) * * * */APPLICATION/APACHE/BIN/APACHECTL Graceful

means to restart Apache every night at 21:30.

5) 4 1,10,22 * */application/apache/bin/apachectl Graceful

indicates a 1, 10, 22nd 4:45 restart of Apache

6) 1 * * 6,0/application/apache/bin/apachectl Graceful

to restart Apache every Saturday, Sunday, 1:10 hours of the morning.

7) 0,30 18-23 * * */APPLICATION/APACHE/BIN/APACHECTL Graceful

indicates that Apache restarts every 30 minutes from 18:00 to 23:00 every day

8) * 23,00-07/1* * */application/apache/bin/apachectl Graceful

represents at point to the next day - Restarts every hour of the minute between points Apache

9) * 4 1-3/application/apache/bin/apachectl Graceful

for April, every Monday to Wednesday 11 o'clock in the morning full restart Apache

Second, write out timing rules based on text description :

1) May 5 9:00 go to the old boy training class. The rules are:

#00 09 05 05 * Go to the old boy training class

2) every Sunday 9:30 district old boy education training. The rules are:

#30 09 * * 0 go to old boys education training

C The Rond service is a running program that can execute system instructions or script scripts through crontab at a fixed interval of time. The units of the time interval can be minutes, hours, days, months, weeks, and any combination (day and week), which is suitable for enterprise operations scenarios such as periodic log analysis or data backup.

Old boy Linux Crond scheduled tasks exercises

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.