Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

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
Avatar of me655321
me655321

Here are some options...
http://www.robvanderwoude.com/wait.php
Avatar of gr8gonzo
Put sleep(60); as the last line in acme.php and remove that line from your batch file.
Avatar of rgb192

ASKER

sleep(60);
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.
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);
?>
Avatar of rgb192

ASKER

with
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)
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
Avatar of segurah
segurah

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
Avatar of rgb192

ASKER

downloaded
http://www.computerhope.com/download/utility/sleep.exe

but where do i place this file

in windows web server 2008
SOLUTION
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
Avatar of rgb192

ASKER

sleep.exe makes sleep work when put in c:\windows\