File:  [LON-CAPA] / loncom / debugging_tools / getties.pl
Revision 1.2: download - view: text, annotated - select for diffs
Mon Jul 4 09:24:50 2011 UTC (12 years, 10 months ago) by foxr
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, language_hyphenation_merge, language_hyphenation, HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
Centralize knowledge of where the tmp directory is within LONCAPA.pm

    1: #
    2: # as this is a standalong file..that may ot be able to access the LONCAPA
    3: # module, I'm leaving the temp directory knoweldge uncentralized
    4: #    - R. Fox 7/1/2011
    5: #
    6: 
    7: use strict;
    8: 
    9: my $loncapa_tempdir = '/home/httpd/perl/tmp'; # configure the temp dir here.
   10: 
   11: my $result=`ls -l /proc/*/fd/* | grep $loncapa_tempdir`;
   12: my @result=split("\n",$result);
   13: my (@pids,@files);
   14: foreach my $line (@result) {
   15: 	if ($line=~m-/proc/(\d+)/fd-) {
   16: 		push(@pids,$1);
   17: 		$line=~m-(/home/httpd/perl/tmp/.*)-;
   18: 		push(@files,$1);
   19: 	}
   20: }
   21: 
   22: $result=`wget --http-user=lonadm -q --http-passwd=litelite --output-document=- http://localhost/server-status`;
   23: 
   24: @result=split('<tr>',$result);
   25: 
   26: foreach my $line (@result) {
   27: 	if ($line =~ m -</b><td>(\d+)<td>-) {
   28: 		my $curpid=$1;
   29: 		print ("curpid is $1\n");
   30: 		for (my $i=0;$i<=$#pids;$i++) {
   31: 			my $pid=@pids[$i];
   32: 			my $file=@files[$i];
   33: 			if ($curpid == $pid) {
   34: 				$line=~m-<td nowrap>([^<]*)</tr>-;
   35: 				print("$pid has a tmp file $file, last known request is $1\n");
   36: 			}
   37: 		}
   38: 	}
   39: }
   40: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>