in reply to Controlling Shared Memory Id's
while (1 == 1) { # #Clear any unused shared memory pages # print $x++ ."\n"; %oldpids=%newpids; %newpids=(); select (undef,undef,undef,1.25); $presult=`ipcs -m |grep -v - | grep -v bytes | grep -v dest`; @parts = split("\n", $presult); foreach $w (@parts) { select (undef,undef,undef,0.05) ; #print "ipcs: $w\n"; @pidparts=split(" ", $w); $thispid = $pidparts[1]; $presult1=$pidparts[5]; if ($presult1 eq 0) { $newpids {$thispid} = $thispid; print "checking ssh id: pid: -$thispid- current attached - +$presult1-\n"; select (undef,undef,undef,0.05) ; if ($oldpids{$thispid} == $thispid) { print "removing ssh id: pid: -$thispid- current attach +ed -$presult1-\n"; $pcmd="ipcrm shm \"$thispid\""; print "pcmd: $pcmd\n"; $presult1 = `$pcmd`; print "presult1: $presult1\n"; select (undef,undef,undef,0.05) ; } } } }
|
|---|