In linux, php scripts are regularly executed. This article describes how to implement regular execution of php scripts in linux. it is a very good article and is recommended here. Implement regular execution of php scripts in linux
This article mainly introduces how to implement regular execution of php scripts in linux and its examples. it is a very good article and is recommended for you here.
Enter commands in linux
The code is as follows:
Crontab-e
Then, use the vim command to edit the opened file and enter
The code is as follows:
0 ***/usr/bin/php-f/home/userxxx/update. php
Save and exit. now, the system will automatically execute the update. php script at each time. the script can be used to write database execution, automatic mail, and other functions.
Note: writing 0 *** php-f/home/userxxx/update. php does not work.
In addition, the cronjob format is:
MIN HOUR DOM MON DOW CMD
Field |
Description |
Allowed Value |
MIN |
Minute field |
0 to 59 |
HOUR |
Hour field |
0 to 23 |
DOM |
Day of Month |
1-31 |
MON |
Month field |
1-12 |
DOW |
Day Of Week |
0-6 (0 indicates Sunday) |
CMD |
Command |
Any command to be executed. |
Use (-) to define the scope
For example, 0 0-6 *** command indicates that the command is executed at every day.
Use (,) to enumerate the time
For example, "0, 15, 30, 45 *** command" indicates that the command is executed at, and each hour.
Use (/) to specify the interval
For example, **/4 ** command indicates that the command is executed every four hours.
Combination
0-10/2 *** command indicates that the command is executed every two minutes in the first 10 minutes.
This article mainly introduces how to implement regular execution of php scripts in linux and its examples. it is a very good article and is recommended here. In...