Php script execution on a regular basis in linux

Source: Internet
Author: User
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...

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.