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;
}
perl question using system() and sleep() problem
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
What are you trying to get you program to do?
There are 3 ways I do process spawning stuff (1) Use system, I hardly ever use this (2) use `<command>` or qx, I use this for most things or (3) if you want to do something else while the command is being run or to limit a wait, use fork and exec. Without knowing what you want it to do I can't recommend which to use.
You could also use perlthreads if you are feeling brave
There are 3 ways I do process spawning stuff (1) Use system, I hardly ever use this (2) use `<command>` or qx, I use this for most things or (3) if you want to do something else while the command is being run or to limit a wait, use fork and exec. Without knowing what you want it to do I can't recommend which to use.
You could also use perlthreads if you are feeling brave
Phil
Thanks for the reply, I am trying to start another daemon program if the time meets. this is cronlike program, so for example, if the time is equal to midnight, my daemon script would be run. so right now i am using system(), but the bad thing about system() is that it will wait until the child process is finish, so my parent daemon process stucks there not doing anything while the time hits midnight.
which one do you recommend me to use in this case phil?
thanks alot.
which one do you recommend me to use in this case phil?
thanks alot.
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact: