There is a script that can run for over an hour. The script is launched by ajax on the start button. How can I send a signal to the script so that it stops?
At the end of the script should make the statistics how much worked.
There is an idea to create a file at startup. And check for its availability. If it is, then continue to work. Is there a better way?
if(isset($_GET['stop'])){ unlink('check_file'); return 'deleting!!!!'; } if(!file_exists('check_file')){ fopen('check_file','w'); } for ($i = 0; $i < 10; $i++) { if(file_exists('check_file')){ //Есть другие варианты? //времязатратная задача info('working...'); sleep(1); } else { break; } } info('job stopped. was working: ' . $i . ' seconds'); The project does not allow the use of radishes or web sockets.