Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Example Analysis of scheduled tasks under linux

Shulou Source: shulou.com Published: 2022-06-01 14:19:51 09月26日 Update

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!

Tags: Faceted tasks examples methods grouping commands services examples analysis content week more articles good practical guys buddies hours files articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Linux Shulou Information MariaDB Redmi