[LON-CAPA-cvs] cvs: loncom /debugging_tools getties.pl
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 12 Jun 2003 21:00:19 -0000
albertel Thu Jun 12 17:00:19 2003 EDT
Added files:
/loncom/debugging_tools getties.pl
Log:
- the requested script to find out what ties are being held and what the last command that apache child did (or is currently doing) is
Index: loncom/debugging_tools/getties.pl
+++ loncom/debugging_tools/getties.pl
use strict;
my $result=`ls -l /proc/*/fd/* | grep /home/httpd/perl/tmp/`;
my @result=split("\n",$result);
my (@pids,@files);
foreach my $line (@result) {
if ($line=~m-/proc/(\d+)/fd-) {
push(@pids,$1);
$line=~m-(/home/httpd/perl/tmp/.*)-;
push(@files,$1);
}
}
$result=`wget --http-user=lonadm -q --http-passwd=litelite --output-document=- http://localhost/server-status`;
@result=split('<tr>',$result);
foreach my $line (@result) {
if ($line =~ m -</b><td>(\d+)<td>-) {
my $curpid=$1;
print ("curpid is $1\n");
for (my $i=0;$i<=$#pids;$i++) {
my $pid=@pids[$i];
my $file=@files[$i];
if ($curpid == $pid) {
$line=~m-<td nowrap>([^<]*)</tr>-;
print("$pid has a tmp file $file, last known request is $1\n");
}
}
}
}