RedHatLinux regularly executes PHP files

Source: Internet
Author: User
SHELL =/bin/bashPATH =/sbin:/bin:/usr/sbin:/usr/binMAILTO = rootHOME =/# run-parts01 *** rootrun-parts/etc/cron. hourly024 *** rootrun-parts/etc/cron. dailypolic** 0rootrun-parts/etc/cron. w

SHELL =/bin/bash
PATH =/sbin:/bin:/usr/sbin:/usr/bin
MAILTO = root
HOME =/

# Run-parts
01 *** root run-parts/etc/cron. hourly
02 4 *** root run-parts/etc/cron. daily
22 4 ** 0 root run-parts/etc/cron. weekly
42 4 1 ** root run-parts/etc/cron. monthly
01 8 *** root/home/www/db_back/bk. sh
10 8 * root/opt/lampp/bin/php/home/www/deleteOldDB. php

/Opt/lampp/bin/php is your php installation directory. You can set it based on your server.

You can first try to execute the. php file in the shell on your server. If so, this directory can be used.

Such as: cd/opt/lampp/bin press ENTER

Xxxxx $:./php/var/www/test. php

If you can execute it, you can use this directory, the server version is different from the directory, Ubuntu to install php5-cli can be used.

Then you can edit the crontab file. The code above vi/etc/crontab is.

I have a lot of online information about # bath... and so on in the php file. I tried it and can execute it without adding it ,.

/Opt/lampp/bin/php: the php Execution file to this directory. Use this file to execute the absolute target. php file, such as the/home/www/deleteOldDB. php file.

You can also access the directory XXXX #: cd/opt/lampp/bin/php in shell and enter./php/home/www/deleteOldDB. php.

In this way, you can access the php file. If you cannot access the php file here, the scheduled execution will not be able to be executed.

Related Article

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.