-
- //When it is 0, close the scheduled task
- return 1;
- ?>
Copy code
2, jbxue.php
-
- ignore_user_abort();//Close the browser and the PHP script can continue to execute.
- set_time_limit(0);//The program can be executed without limit through set_time_limit(0)
- $interval=60*3;//Run every 3 minutes
- $ii=0;
- do{
- $run = include 'jhrw.conf.php';
- if(!$run) {
- file_put_contents("tasktest .txt","==Scheduled task has ended==rn",FILE_APPEND);
- die('Job has ended.');
- }
- //Put the code to be executed here
- sleep($interval);/ / Wait for 3 minutes
- $nowTime = date("Y-m-d H:m:s");
- $data="$ii>The scheduled task is running... (Running status: $run) $nowTimern";
- file_put_contents( "tasktest.txt", $data,FILE_APPEND);
- $ii++;
- }while(true);
- //by bbs.it-home.org
- ?>
Copy code
Mainly change jbxue. Return 0 in conf.php can control the shutdown of this scheduled task.
|