ׁHello, Vishal, On Thu, 6 Oct 2011 15:00:22 +0530 Vishal Gupta <vishal.knit2...@hotmail.com> wrote:
> > > > > > Hi, > > I have to write a perl program (Parent script) which does the below 4 tasks > simultaneously: > > 1. Executing a perl script in one shell. (Parent script) > 2. Invoking a thread performing some tasks periodically lets say once in 15 > min, and send a message when any task is completed, to parent shell. > 2. Invoking a thread which is continuously checking the memory and cpu usage > using "top" command and inform to parent script if it exceeds 50%. > 3. Doing "ls -l" for a directory (containing 4 files) per minute and check if > size of any file increases. > 4. Invoking a "shell script" which has a execute in every 10 min and sending > the result each time to file. > > The parent script has to execute continuously for 12 hours. > > Could you please tell me, how can i create this script ? Which concepts of > Perl should I use for the above script? Please share with me the link, where > can I get the tutorial/sample code of those concepts? Well, I would suggest against limiting your specification to a certain implementation - namely using perl's threads here: http://www.perlmonks.org/?node_id=288022 Multi-threading in Perl is very problematic and should usually be avoided. You can usually achieve what you want using either multi-processes or using an event framework such as POE: http://perl-begin.org/uses/multitasking/ Regards, Shlomi Fish > > Appreciate your help. > > Thanks & regards, > Vishal > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Original Riddles - http://www.shlomifish.org/puzzles/ JATFM == “Just answer the fabulous man” Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/