I have this code:
<?PHP
ignore_user_abort(true);
set_time_limit (0);
while(1) {
// my codes
}
?>
now After a while how to detect that script is running yet or not?
I used this role for this question:
<?PHP
ignore_user_abort(true);
set_time_limit (0);
while(1) {
// my codes
$statusfile = strtolower(file_get_contents('status.txt')); // for stop checking
if (!(strpos($statusfile,'stop') !== false)) break;
$status = /* my status */; // for writing status of itself
file_put_contents('status.txt', $status);
}
?>
but in this role my script itself must write status of itself and if Suddenly stopped (such as server reset or occuring an error in script) will not write any status and we cant detect status of it such as is stopped or runnig.
now I want know that how can I detect runnig status of a script from out?
and how can I stop it from out?