Linux Task Scheduler command (easy to manage Linux)

Source: Internet
Author: User

Linux task scheduling is actually to let the system at some time to execute certain commands or programs, so that it makes it easier for administrators to manage their own Linux, when I first learned this method, my heart filled with endless joy, I feel Linux is too powerful.

I'm going to tell you the exact order.

One: Task scheduling classification

1. The system works, some important work must be carried out in a cycle, such as virus scanning

2. Individual users may wish to perform certain programs, such as opening the music player at timed intervals.

II: Location of the Task Scheduler file

/etc/crontab

Three: Personal task scheduling command

Crontab-e

Then enter the Task Scheduler file, such as * * * * * Date >>/home/yixiang/mytask1

This sentence indicates that the time is written to/home/yixiang/mytask1 every minute

Five * Critical

The first * represents minutes per hour of execution 0-59

The second * represents hours per day of the first few hours of execution 0-23

The third * represents the day of the month of the day of execution 1-31

Fourth * indicates the monthly calendar of the month to execute 1-12

The fifth * represents the day of the week of weekly execution 0-6

Terminating task scheduling

Crontab-r

List which tasks are currently scheduled

Crontab-l

I'm going to show you the picture below.

The first of these methods

Input command CRONTAB-E into the Task Scheduler interface

Task Scheduling interface

The use of five * in this interface, please refer to the above, * the following is the user instruction, this sentence means that every minute of the date written to the/home/mytask3 file

Although this method can also be multi-command interface, but Linux is a multi-tasking multi-user operating system, if a few users have used the user scheduling command, then the system does not know how to execute the problem is prone to problems

The second method of

Switch to Root,ls to view the root file directory, and then create a new file mytask1.sh

Enter the vi edit interface and type the program you want to run, which means to append the date to the/home/mytesk3 file

Check to see if this file is set up in/root and give this file x executable permissions chmod 744 mytask1.sh

Access to task scheduling interface

Input instructions, instruction format reference described above, * followed by the shell file just written path can be

View Results

As of now, the result of the Task Dispatch command execution

Terminating programs viewing task scheduling and those execution commands


The second command uses Shell programming for multi-command writing, so that even if there are many users do task scheduling system will not be confused, so a large program to ensure the security and stability of the program operation, and this method is relatively simple, only need to invoke a shell file can be

Turn from (http://www.linuxidc.com/Linux/2013-06/85485.htm)

Linux Task Scheduler command (easy to manage Linux)

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