[sf-perl] How to monitor a spawned sub-process

Herb Rubin herbr at pfinders.com
Wed Aug 9 17:09:45 PDT 2006


Fork it and check the process after 10 minutes. You'll have the process id in the parent fork.


----- Original Message -----
From: Peter # PHX Loo <Peter.Loo at source.wolterskluwer.com>
To: sfpug at sf.pm.org
Sent: Wednesday, August 9, 2006 4:25:31 PM GMT-0800
Subject: [sf-perl] How to monitor a spawned sub-process

Hi All, 

I was wondering if there is a good way to monitor a spawned process within a Perl program. For example: I am using Perl DBI to run a SQL command. However, I would like to give the SQL process some time to complete and at some point break out and quit if a set time has been exceeded. Code example: 

eval { 
$dbh->do("insert into table1 select a.col1, a.col2, b.col4 from table1 a, table2 b"); 

So if the above process does not complete after 10 minutes, I was to quit out of the program. 

Hope this information is clear. 


Herb Rubin
Pathfinders Software

More information about the SanFrancisco-pm mailing list