Linux timed execution PHP code-timing Plan Crontab

Source: Internet
Author: User

1. Create the demo.php demo file code as follows:

<? PHP Echo  Rand (1,99999). Php_eol;  // generate a different number each time

2.linux crontab Execution

3. Go to crontab edit to add the

* * * * * * php/var/html/demo.php >>/var/www/html/demo. Log // The above code indicates that the demo.php is executed once per minute and the output record is saved to Demo.log//The first * indicates the Minutes//the second * indicates the hour//the third * indicates the day//fourth * indicates the month//fifth * represents the week//every morning 6 points//0 6 * * Every two hours//0 */2 * * *//night 11 o'clock to 8 a.m. every two hours and morning eight o '//0 23-7/2,8 * * *//4th number per month and Monday to Sunday three morning 11//0 4 * 1-3 C//1 month 1st morning 4/ /0 4 1 1 *  

Tip: If there are 2 scheduled tasks that need to be executed in the editor, write a

Finally, here's a:

Linux timed execution PHP code-timing Plan Crontab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.