Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of scheduled tasks under linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you the content of a sample analysis of scheduled tasks under linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

First of all, I would like to explain to you, the editor explained to you is to achieve this operation under Linux, as for Windows, you can also explain later!

(1) We need to use the command yum install-y vixie-cron to install the scheduled task service. Friends can use crontab-e to check whether the server has this service or not before installation!

(2) after installation, we can use crontab-e to add our planned tasks. Let me write some examples for you:

* / 1 * / usr/bin/curl-o temp.txt http://www.baidu.com/index.php/Api/Contab/offeredCoupon

Execute the offeredCoupon method under the following Api grouping every minute

30 21 * / usr/bin/curl-o temp.txt http://www.baidu.com/index.php/Api/Contab/offeredCoupon

The above example shows that the offeredCoupon method under the following Api grouping is executed at 21:30 every night

45 4 1 temp.txt 10 22 * * / usr/bin/curl-o temp.txt

The above example shows that the offeredCoupon method under the following Api grouping is executed at 4: 45 on the 1st, 10th, and 22nd of each month

10 1 * 6 usr/bin/curl 0 / usr/bin/curl-o temp.txt http://www.baidu.com/index.php/Api/Contab/offeredCoupon

The above example shows that the offeredCoupon method under the following Api grouping is executed at 1: 10 every Saturday and Sunday

Note (the following is the explanation for the above):

* command

Time-sharing, day, month and week order

Column 1 represents minutes 1: 59 per minute is represented by * or * / 1.

The second column represents the hour 1: 23 (0 means 0 o'clock)

The third column represents the date 1: 31

The fourth column represents the month from January to December.

The fifth column identification number is 0006 (0 means Sunday)

Column 6 commands to run

(3) after compiling the file, press the ESC key, and then (: wq) save and exit

(4) service crond restart restarts the scheduled task

Thank you for reading! This is the end of this article on "sample analysis of planned tasks under linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report