Hello list,

i have a small perl script checking up port in a network, for each ip it
forks for speedup reasons like this, maximum forks is 20:

use SAP::DBTech::sapdb;

        &$dbh=dbOpen();
.
.
.
foreach $ip(@hosts)
{
       if($pid = fork)
             {
              $forked++;
              $pidh{$pid}=$pid;
             }
       else {
        foreach(keys(%ports))
            {
                $p=$_;
                $s=$ports{$p};
                &check($ip,$p,$s);
            }
              exit 0;
            }
}

sub check
{
        test_for_changes();
        &saveRecord($ip, $port,$ip);}
}

saverecord() then write a simple insert query into the database.

My questions : 

1.) it does not write anything to the database, unless i do the dbOpen()
directly in the forked saveRecord routine, which is not the fastest way
i think, even if i commit() in saverecord

2.) is the perl driver safe to use a db-handle before forktime in the
forked child later (is the same handle in all childs i guess)?

Regards Kai


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to