?
Solved

sleep' is not recognized as an internal or external command operable program or batch file.

Posted on 2009-12-23
12
Medium Priority
?
5,840 Views
Last Modified: 2012-05-08
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
0
Comment
Question by:rgb192
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 4

Expert Comment

by:me655321
ID: 26113750
Here are some options...
http://www.robvanderwoude.com/wait.php
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 26113819
Put sleep(60); as the last line in acme.php and remove that line from your batch file.
0
 

Author Comment

by:rgb192
ID: 26113880
sleep(60);
and
sleep(60)

still generate same error in windows server 2008
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 26

Expert Comment

by:MidnightOne
ID: 26113919
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.
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 26113921
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);
?>
0
 

Author Comment

by:rgb192
ID: 26113997
with
sleep(60) in acme.php


would acme.php run 200 times in one minute
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 26114023
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)
0
 
LVL 6

Expert Comment

by:segurah
ID: 26114201
sleep command is in Windows Server 2008 Resource Kit, also you can copy sleep.exe from you windows 2003 to your windows 2008.
0
 
LVL 6

Accepted Solution

by:
segurah earned 1000 total points
ID: 26114206
0
 

Author Comment

by:rgb192
ID: 26114357
downloaded
http://www.computerhope.com/download/utility/sleep.exe

but where do i place this file

in windows web server 2008
0
 
LVL 35

Assisted Solution

by:gr8gonzo
gr8gonzo earned 1000 total points
ID: 26114460
Just place it in your main Windows directory (usually C:\WINDOWS).

However, did you try my suggested code? It should work. If it doesn't, post the contents of acme.php - maybe acme.php is exiting the script before it gets to the sleep() command.
0
 

Author Closing Comment

by:rgb192
ID: 31669491
sleep.exe makes sleep work when put in c:\windows\
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question