First write the PHP program you need to execute
What I'm doing here is a PDO link to write a time
Then we write a shell script to execute this PHP program
A simple shell that executes a PHP program is written, and we run it.
OK, the display is successful and proves that the shell can be executed.
Then we'll write a crontab scheduled task.
And then introduce what the five stars say about each other:
Minute-minutes, any integer from 0 to 59
Hour-hours, any integer from 0 to 23
Day-days, any integer from 1 to 31 (if a month is specified, it must be a valid date for that month)
Month-months, any integer from 1 to 12 (or use the English shorthand for the month such as Jan/feb, etc.)
DayOfWeek-week, any integer from 0 to 7, where 0 to 7 stands for Sunday (or a week of English shorthand such as Sun/mon, etc.)
OK, after the introduction we start to write (note to use root permissions sudo crontab-e)
And then inside, that's all you can write.PS: You need to give demo.sh and test.php permission to execute. (The small part is because the authority causes not to execute, therefore everybody should notice) chmod +x test.php/demo.sh
Shell script executes PHP program at timed time