-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem when executing with sleep in a script #7
Comments
I think this is because the script only measures cpu and sys time, and not real time. For example, running
This means that If you need to limit the real time of a process, try the native bash
|
Hi,
I don't know if this is an issue with this script, but when you execute a shell script with
sleep {sleep_time}
in it, then the timeout does not terminate the script/program.I am attaching the code which i tried to run below,
!/bin/bash
i=1;
while [ $i -lt 10000000 ]
do
echo "$i second" ;
i=$[$i+1];
sleep 1;
done
I also tried using it with java program using threads but same result with that as well.
Java code below,
import java.util.;
import java.text.;
import java.math.;
import java.io.;
public class TestClass {
public static void main(String[] args) {
int i=1;
try {
while(true)
{
System.out.println(i++);
//thread to sleep for the specified number of milliseconds
Thread.sleep(1000);
}
} catch ( java.lang.InterruptedException ie) {
System.out.println(ie);
}
}
}
Please help me out here. Thanks in advance.
The text was updated successfully, but these errors were encountered: