before we know SSH Service Optimization and Client command operation, these are our basic services must be mastered, today we talk about Linux of Scheduled Tasks. As the name implies, some tasks are performed regularly. Like our alarm clock, timed alarm. I have a lot of time to use him later. So we have to play up the spirit, pay attention to, do not think he is very simple, not serious study. Needless to say, we already know the concept of timed tasks. How to write timed tasks under Linux, how to manage scheduled tasks This is the focus of my study. 650) this.width=650; "src=" Http://img.baidu.com/hi/ldw/w_0004.gif "alt=" w_0004.gif "/>
Linux task is also a service, the name of the service is called Crond, only by opening this service can we write our scheduled tasks, and through this service we can manage our scheduled tasks. Check to see if my Computer opens this service 650) this.width=650; "src=" Http://img.baidu.com/hi/ldw/w_0040.gif "alt=" W_0040.gif "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7C/9E/wKioL1bT40uxZXm2AAB9Hi3zIoQ338.png "title=" QQ picture 20160229111010.png "alt=" Wkiol1bt40uxzxm2aab9hi3zioq338.png "/>
See it! Here I use the chkconfig--list command to view the crond service at 3,4, 5 levels are powered on from the boot so my service is open, if you do not open this service can not use Scheduled Tasks Oh! How can I open him up when I need it? Look underneath .
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7C/9E/wKioL1bT45-xKcDsAACqnQG2b_8158.png "title=" QQ picture 20160229111830.png "alt=" Wkiol1bt45-xkcdsaacqnqg2b_8158.png "/>
we are Linux all the services below can be started and switched off through the above command structure. Its command structure: service Name {stop,start,restart}. This is our simple service management. It's Convenient!
Service Management We know, then we'll talk about how to write a timed task. When writing a timed task, we first need to know what his format is! Look underneath .
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7C/9F/wKiom1bT43aiBtoFAABHeEkoXls130.png "title=" QQ picture 20160229112931.png "alt=" Wkiom1bt43aibtofaabheekoxls130.png "/>
The above points is the meaning of the minute, when the meaning of the hour, day is the meaning of the day, the month is the month, week is the week. The following command is the task you are going to perform. 650) this.width=650; "src=" Http://img.baidu.com/hi/ldw/w_0039.gif "alt=" W_0039.gif "/>
Write timed tasks The most troublesome is in the expression of time, below I do a detailed explanation of the time expression:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7C/9E/wKioL1bT5A3wcdOZAACCENAtYDw438.png "title=" QQ picture 20160229133657.png "alt=" Wkiol1bt5a3wcdozaaccenatydw438.png "/>650) this.width=650;" src= "/HTTP/ S2.51cto.com/wyfs02/m00/7c/9f/wkiom1bt47xjptvyaab56j7svf0342.png "title=" qq picture 20160229134314.png "alt=" Wkiom1bt47xjptvyaab56j7svf0342.png "/>
This is how time is expressed, and then we begin to write Linux timed tasks. It 's also easy to write timed tasks under Linux, using the crontab command to see the following
crontab Command Options :
- e edit a user's tasks
- R Delete a user's task
- L View Scheduled Tasks
I now write the example above to my server as follows
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7C/9E/wKioL1bT5EqibbO9AAAcl7RCI7I889.png "title=" QQ picture 20160229135428.png "alt=" Wkiol1bt5eqibbo9aaacl7rci7i889.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7C/9E/wKioL1bT5GmRkwjOAAAtSfXqn78721.png "title=" QQ picture 20160229140106.png "alt=" Wkiol1bt5gmrkwjoaaatsfxqn78721.png "/>
How to view our editor's scheduled tasks, see below
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7C/9E/wKioL1bT5L-xdTU4AAAh8oCYTRc595.png "title=" QQ picture 20160229140501.png "alt=" Wkiol1bt5l-xdtu4aaah8ocytrc595.png "/>
Similarly, we can also use the following direct view
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7C/9E/wKioL1bT5NeAmFZCAAAbYiAwg5o038.png "title=" QQ picture 20160229140915.png "alt=" Wkiol1bt5neamfzcaaabyiawg5o038.png "/>
Delete Scheduled Tasks I don't have to say more, you edit that file directly, or you can use
Crontab-r commands are available.
The content of the scheduled task is so much, his main difficulty is the time expression. I hope you will make the time clear.
650) this.width=650; "src=" Http://img.baidu.com/hi/ldw/w_0022.gif "alt=" W_0022.gif "/>
This article from "Lele Run" blog, please be sure to keep this source http://10851431.blog.51cto.com/10841431/1745991
Linux timed task management