rgb192
asked on
sleep' is not recognized as an internal or external command operable program or batch file.
batch script
@echo off
:loop
"C:\php\php.exe" "D:\Data\acme.php"
sleep 60
goto loop
this worked in windows server 2003 but not windows server 2008
batch script is looping
but no sleeping
want to pause for 60 seconds
@echo off
:loop
"C:\php\php.exe" "D:\Data\acme.php"
sleep 60
goto loop
this worked in windows server 2003 but not windows server 2008
batch script is looping
but no sleeping
want to pause for 60 seconds
Put sleep(60); as the last line in acme.php and remove that line from your batch file.
ASKER
sleep(60);
and
sleep(60)
still generate same error in windows server 2008
and
sleep(60)
still generate same error in windows server 2008
in place of sleep(60) in your batch file try ping 127.0.0.1 -n 61 >NUL
This should have the effect of pausing the script for 60 seconds.
This should have the effect of pausing the script for 60 seconds.
I don't think you're putting it INSIDE acme.php.
If it's in the batch file, then Windows will try to look for a Windows program called "sleep", which is not there by default. But sleep(60) is a valid PHP command and will work if it is inside the acme.php flie.
Your batch file should just look like:
@echo off
:loop
"C:\php\php.exe" "D:\Data\acme.php"
goto loop
And acme.php should look like:
<?php
// all of the normal acme.php code here
sleep(60);
?>
If it's in the batch file, then Windows will try to look for a Windows program called "sleep", which is not there by default. But sleep(60) is a valid PHP command and will work if it is inside the acme.php flie.
Your batch file should just look like:
@echo off
:loop
"C:\php\php.exe" "D:\Data\acme.php"
goto loop
And acme.php should look like:
<?php
// all of the normal acme.php code here
sleep(60);
?>
ASKER
with
sleep(60) in acme.php
would acme.php run 200 times in one minute
sleep(60) in acme.php
would acme.php run 200 times in one minute
It should not. The batch file will wait until php.exe finishes running acme.php before running it again. So if acme.php is sleeping for 60 seconds, then acme.php will run once, sleep for 60 seconds, and then exit, and the batch file should THEN restart the loop and run acme.php again. So it should only run once per minute.
Also, it takes a second or two for php.exe to start and end, so each full loop might actually take something like 65 seconds (or more, if acme.php normally takes a while to run)
Also, it takes a second or two for php.exe to start and end, so each full loop might actually take something like 65 seconds (or more, if acme.php normally takes a while to run)
sleep command is in Windows Server 2008 Resource Kit, also you can copy sleep.exe from you windows 2003 to your windows 2008.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
downloaded
http://www.computerhope.com/download/utility/sleep.exe
but where do i place this file
in windows web server 2008
http://www.computerhope.com/download/utility/sleep.exe
but where do i place this file
in windows web server 2008
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sleep.exe makes sleep work when put in c:\windows\
http://www.robvanderwoude.com/wait.php