Link to home
Start Free TrialLog in
Avatar of doyle007
doyle007

asked on

Conditional Wait Time - PHP

Currently I have the following piece of code:
**************
exec("C:\MQInjector\MQexecuteBat.exe") or die("Error when running MQ Client");

usleep(2000000);

$fileread="C:\MQInjector\ChgPwd1.out";
$chgpwdo=fopen($fileread, "r") or die("Error - MQ Client did not complete run");
$read=fread($chgpwdo, filesize($fileread));
fclose($chgpwdo);
*************

The exec statement creates the ChgPwd1.out file, therefore I have put the 2second wait in there to ensure the file is created. However, this is probably not the best way to do it.

Is it possible to structure this to ensure the file is created and current (Note that the exec command may also over-write an existing copy of the ChgPwd1.out file)?
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial