After trying in Linux
Crontab-e
Direct edit
0 * * */usr/bin/php/var/www/html/business/crontab.php
If you have require other files in your crontab.php, execution may be problematic, so it is recommended that you do not use this method.
We can do this:
First set up in one place. SH Shell file is a new crontab.sh file than I did under/root/shell. Write:
#!/bin/sh
/usr/bin/links-source/crontab.php
Then add the entries in the CRONTAB-E
0 * * */bin/bash/root/shell/crontab.sh
This will be OK, every day at 11 o ' The file will be executed!
Time rule with crontab instruction
The order and value range of five fields and their meanings are:
0~59-
1~23 means hours
1~31 said Day
1~12 represents the Month
0~6 said week (of which 0 said Sunday)
If you are using a task that is not executed in hourly monthly weekly, you can write the corresponding crontab to the crontab or CRON.D directory.
Example:
Perform a script every minute/opt/bin/test-cron.sh
You can create a new script in CRON.D echo-date.sh
Content is
*/1 * * * * root/opt/bin/test-cron.sh
Execute PHP Script
Method 1
If you want to execute a PHP script on a regular basis, you can write it directly:
*/1 * * * * * root-q/bin/local/php/path/to/your/php/script.php (script.php per minute)
Note that you need to turn PHP into an executable script file. At the command line, the directory where the script resides
chmod +x script.php
Example 1
Execute PHP scripts regularly under Linux
Write in the normal way
? Php
$file = '/htdocs/www/b100/egspace/bin/test/'. Date (' H '). -'. Date (' I '). -'. Date (' s '). TXT ';
File_put_contents ($file, date (' y-m-d '));
?>
Change the PHP file attribute to a shell file:
chmod +x test.php
Re-edit crontab:
Crontab-e
Add one line:
*/1 * * * */usr/local/bin/php-q/htdocs/www/b100/egspace/bin/test.php