Home > Archive > PERL Beginners > October 2006 > system() and sleep()
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
system() and sleep()
|
|
| mike888@berlin.com 2006-10-06, 6:57 pm |
| Hi,
I want to ask you guys, how to run my_program.pl without interupting or
stoping the sleep() below, because what happened was the sleep stops
doing its job waiting for the system("my_program.pl") to be completed.
i tried using exec but exec stop the sleep right away.
Thanks for any help.
while(1) {
system ( "my_program.pl" );
sleep 60;
}
| |
|
|
mike888@berlin.com wrote:
> Hi,
>
> I want to ask you guys, how to run my_program.pl without interupting or
> stoping the sleep() below, because what happened was the sleep stops
> doing its job waiting for the system("my_program.pl") to be completed.
> i tried using exec but exec stop the sleep right away.
>
> Thanks for any help.
>
> while(1) {
> system ( "my_program.pl" );
> sleep 60;
> }
What exactly are you trying to do?
Your 'system' call (with "my_program.pl" as an argument) cannot
interrupt
or stop your sleep call. system does not return control to your program
until my_program.pl has finished (which may be very quickly if it
failed
to find this program or even if the program runs).
Once system finishes, then your program will do nothing for 60
seconds.
I don't know what you mean by "sleep stops doing its job".
Maybe you can clarify what is happening and what you think is wrong.
Ken
| |
| mike888@berlin.com 2006-10-06, 9:57 pm |
| thanks for the reply, what i mean is that the my_program.pl is
monitoring daemon, so it will take more than 5 minutes to run depending
on the web user, so while my_program.pl is being executed, the sleep 60
is not doing anything until 5 minutes. and sorry that i actually have
another system() call code underneath that system("my_program.pl") but
i didn't write it down. so the other system() call is not being
executed like i wanted it whiches 60 seconds sleep. it could be 5
minutes, it could be 10 minutes.
thank for any helps.
kens wrote:
> mike888@berlin.com wrote:
>
> What exactly are you trying to do?
> Your 'system' call (with "my_program.pl" as an argument) cannot
> interrupt
> or stop your sleep call. system does not return control to your program
> until my_program.pl has finished (which may be very quickly if it
> failed
> to find this program or even if the program runs).
> Once system finishes, then your program will do nothing for 60
> seconds.
> I don't know what you mean by "sleep stops doing its job".
> Maybe you can clarify what is happening and what you think is wrong.
> Ken
| |
| nobull67@gmail.com 2006-10-07, 7:58 am |
|
On Oct 7, 2:38 am, mike...@berlin.com top-posts:
[ please don't top post ]
> thanks for the reply, what i mean is that the my_program.pl is
> monitoring daemon, so it will take more than 5 minutes to run depending
> on the web user, so while my_program.pl is being executed, the sleep 60
> is not doing anything until 5 minutes. and sorry that i actually have
> another system() call code underneath that system("my_program.pl") but
> i didn't write it down. so the other system() call is not being
> executed like i wanted it whiches 60 seconds sleep. it could be 5
> minutes, it could be 10 minutes.
I'm a little but I think you may be asking FAQ: "How do I
start a process in the background?".
|
|
|
|
|