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

How to add scheduled task execution php file under linux system

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "how to add planned task execution php files under the linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Methods / steps

1. Open the linux system command line interface.

Enter the following command in the command line interface: which php, enter.

1. Remember the php path of the previous step, continue to enter: crontab-e, enter at the command line, press the "I" key to enter the editing mode of the vi editor, and enter the following command in the current mode:

10 usr/bin/php 40 50 * / usr/bin/php / opt/lampp/htdocs/wechat/xjtest-web_browser/pcntl_test.php

That is, the frequency of scheduled task execution + php executable file path + php file path to be executed. (the article will explain in detail how often the command starts at the end of the article.)

When the input is complete, press the "ESC" key and enter ":" on the current command line, enter "wq" after ":", and then enter. The following prompt appears to prove that the planned task has been added successfully.

How often Linux scheduled tasks are executed:

The frequency of the beginning of the command consists of five parts, representing minutes, hours, days, months, and weeks (0 is Sunday). When the current frequency is all executed, it is indicated by "*", which is why there are so many "*". The following examples can help you understand:

The following scheduled tasks will run all the time

* [command]

The following scheduled tasks are run at 0 minutes per hour (that is, once per hour)

0 * [command]

The following is still a scheduled task that runs every hour. It just runs at a quarter of an hour. )

15 * [command]

The following scheduled tasks are performed once a day at 2:30

30 2 * [command]

The following planned tasks are performed at midnight on the 2nd of each month (for example: 00:00 on February 2, 2010)

0 02 * [command]

The following scheduled tasks will be performed at 0 minutes every hour on Monday.

0 * 1 [command]

The following will run 3 times per hour, at 0, 10, and 20 minutes

0meme 10meme 20 * [command]

The following is the division sign "/" to indicate how many times to run. This example is run every 5 minutes

* / 5 * [command]

You can also use a "-" to indicate a range, which is run at every hour from 5 to 10:00 as follows

0 5-10 * [command]

There is also a special time keyword @ reboot, which runs scheduled tasks each time the server is restarted

@ reboot [command]

This is the end of the content of "how to add a scheduled task execution php file under the linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Servers

Wechat

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

12
Report