Entering commands in Linux
Crontab-e
Then use the VIM command to edit the open file, enter
0 * * * */usr/bin/php-f/home/userxxx/update.php
Save, exit, OK, now the system will automatically execute the update.php script at each 0 point, the script can write the database execution, automatic email and other functions.
Note : Written directly to 0 * * * * php-f/home/userxxx/update.php will 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 = Sunday) |
Cmd |
Command |
Any command to be executed. |
Use (-) to delimit range
Example: 0 0-6 * * command means 0-6-point execution command per day
Use (,) to enumerate time
such as: 0,15,30,45 * * * * command means 0 points per hour, 15 points, 45 points, 30 Chapter execution command
Use (/) to specify the interval
such as: * */4 * * * command means execute command every four hours
Combination usage
0-10/2 * * * * command means that the command is executed every 2 minutes within the first 10 minutes
Execute PHP scripts using cronjob timer under Linux