lilalo

changeset 52:f9447da96f15

Исправлены глюки с фильтрами host/user
Правильно отрабатывается многократный запуск под FreeBSD
Исправлен глюк с автоматическим выделением URL в комментариях
author devi
date Wed Dec 21 14:39:44 2005 +0200 (2005-12-21)
parents e0db0f8bb482
children eab4f7df854c
files l3-agent l3-cgi l3-frontend l3scripts
line diff
     1.1 --- a/l3-agent	Sun Dec 18 16:56:09 2005 +0200
     1.2 +++ b/l3-agent	Wed Dec 21 14:39:44 2005 +0200
     1.3 @@ -1,4 +1,4 @@
     1.4 -#!/usr/bin/perl -w
     1.5 +#!/usr/bin/perl -w
     1.6  
     1.7  #
     1.8  # (c) Igor Chubin, imchubin@mail.ru, 2004-2005
     1.9 @@ -798,7 +798,7 @@
    1.10  		# Декабрь 2004 год; остальные -- 2005 год.
    1.11  
    1.12  		my $year = 2005;
    1.13 -		$year = 2004 if ( $cl->{day} > 330 );
    1.14 +		#$year = 2004 if ( $cl->{day} > 330 );
    1.15  		# timelocal(			$sec,	   $min,      $hour,      $mday,$mon,$year);
    1.16  		$cl->{time} = timelocal_nocheck($cl->{sec},$cl->{min},$cl->{hour},$cl->{day},0,$year);
    1.17  
    1.18 @@ -961,13 +961,19 @@
    1.19  		if (open(PIDFILE, $Config{agent_pidfile})) {
    1.20  			my $pid = <PIDFILE>;
    1.21  			close(PIDFILE);
    1.22 -			if ( ! -e "/proc/$pid" || !`grep $Config{"l3-agent"} /proc/$pid/cmdline && grep "uid:.*\b$<\b" /proc/$pid/status`) {
    1.23 +			if ($^O eq 'linux' && (! -e "/proc/$pid" || !`grep $Config{"l3-agent"} /proc/$pid/cmdline && grep "uid:.*\b$<\b" /proc/$pid/status`)) {
    1.24  				print "Removing stale pidfile\n";
    1.25  				unlink $Config{agent_pidfile}
    1.26  					or die "Can't remove stale pidfile ". $Config{agent_pidfile}. " : $!";
    1.27  			}
    1.28 +			elsif ($^O eq 'freebsd' && !`ps axo uid,pid,command | grep '$<.*$pid.*$Config{"l3-agent"}' 2> /dev/null`) {
    1.29 +			}
    1.30 +			elsif ($^O eq 'linux' || $^O eq 'freebsd' ) {
    1.31 +				print "l3-agent is already running\n";
    1.32 +				exit(0);
    1.33 +			}
    1.34  			else {
    1.35 -				print "l3-agent is already running\n";
    1.36 +				print "Unknown operating system";
    1.37  				exit(0);
    1.38  			}
    1.39  		}
     2.1 --- a/l3-cgi	Sun Dec 18 16:56:09 2005 +0200
     2.2 +++ b/l3-cgi	Wed Dec 21 14:39:44 2005 +0200
     2.3 @@ -201,7 +201,7 @@
     2.4  			$filter{hostname} = $host if $host;
     2.5  			$filter{user} = $user if $user;
     2.6  			push @args, ("--filter" => join ("&", (map("$_=$filter{$_}", keys %filter))));
     2.7 -			#push @args, ("--filter" => "hostname=".$host."&user=".$user);
     2.8 +			##push @args, ("--filter" => "hostname=".$host."&user=".$user);
     2.9  		}
    2.10  
    2.11  		open (FRONTEND, "./l3-frontend --frontend_css $l3config::Config{frontend_css} ".join(" ",map("\"$_\"",@args))." |");
     3.1 --- a/l3-frontend	Sun Dec 18 16:56:09 2005 +0200
     3.2 +++ b/l3-frontend	Wed Dec 21 14:39:44 2005 +0200
     3.3 @@ -124,7 +124,7 @@
     3.4  
     3.5  sub close_mywi_socket
     3.6  {
     3.7 -    close ($Mywi_Socket);
     3.8 +    close ($Mywi_Socket) if $Mywi_Socket ;
     3.9  }
    3.10  
    3.11  
    3.12 @@ -162,7 +162,7 @@
    3.13          $CommandsFDistribution{$command}++;
    3.14          if (!$Commands_Description{$command}) {
    3.15              my $mywi="";
    3.16 -            $mywi = mywi_client ($command);
    3.17 +            $mywi = mywi_client ($command) || "";
    3.18              $mywi = join ("\n", grep(/\([18]\)/, split(/\n/, $mywi)));
    3.19              $mywi =~ s/\s+/ /;
    3.20              if ($mywi !~ /^\s*$/) {
    3.21 @@ -415,10 +415,11 @@
    3.22              }
    3.23  
    3.24              for my $filter_key (keys %filter) {
    3.25 -                next COMMAND_LINE unless (
    3.26 -                    not defined($cl->{local_session_id}) 
    3.27 -                    || not defined($Sessions{$cl->{local_session_id}}->{$filter_key}) 
    3.28 -                    || $Sessions{$cl->{local_session_id}}->{$filter_key} eq $filter{$filter_key});
    3.29 +                next COMMAND_LINE if 
    3.30 +                    defined($cl->{local_session_id}) 
    3.31 +                    && defined($Sessions{$cl->{local_session_id}}->{$filter_key}) 
    3.32 +                    && $Sessions{$cl->{local_session_id}}->{$filter_key} ne $filter{$filter_key};
    3.33 +		#print $filter_key,"\n";	
    3.34              }
    3.35  
    3.36              #if ($filter{user}) {
    3.37 @@ -452,8 +453,8 @@
    3.38          if ($cl->{class} eq "note") {
    3.39              my $note = $cl->{note};
    3.40              $note = join ("\n", map ("<p>$_</p>", split (/-\n/, $note)));
    3.41 -            $note =~ s@(http:[a-zA-Z.0-9/?%-]*)@<a href='$1'>$1</a>@g;
    3.42 -            $note =~ s@(www\.[a-zA-Z.0-9/?%-]*)@<a href='$1'>$1</a>@g;
    3.43 +            $note =~ s@(http:[a-zA-Z.0-9/?\_%-]*)@<a href='$1'>$1</a>@g;
    3.44 +            $note =~ s@(www\.[a-zA-Z.0-9/?\_%-]*)@<a href='$1'>$1</a>@g;
    3.45              $Result{"body"} .= "<tr><td colspan='6'>";
    3.46              $Result{"body"} .= "<h4 id='note$note_number'>".$cl->{note_title}."</h4>" if $cl->{note_title};
    3.47              $Result{"body"} .= "".$note."<p/><p/></td></td>";
    3.48 @@ -602,8 +603,9 @@
    3.49          if ( $Config{"show_notes"} =~ /^y/i && $cl->{"note"}) {
    3.50              my $note=$cl->{"note"};
    3.51              $note =~ s/\n/<br\/>\n/msg;
    3.52 -            $note =~ s@(http:[a-zA-Z.0-9/?%-]*)@<a href='$1'>$1</a>@g;
    3.53 -            $note =~ s@(www\.[a-zA-Z.0-9/?%-]*)@<a href='$1'>$1</a>@g;
    3.54 +            if (not $note =~ s@(http:[a-zA-Z.0-9/_?%-]*)@<a href='$1'>$1</a>@g) {
    3.55 +		     $note =~ s@(www\.[a-zA-Z.0-9/_?%-]*)@<a href='$1'>$1</a>@g;
    3.56 +	    };
    3.57          #   Ширину пока не используем
    3.58          #   $Result{"body"} .= "<table width='$Config{note_width}' class='note'>";
    3.59              $Result{"body"} .= "<table class='note'>";
     4.1 --- a/l3scripts	Sun Dec 18 16:56:09 2005 +0200
     4.2 +++ b/l3scripts	Wed Dec 21 14:39:44 2005 +0200
     4.3 @@ -7,8 +7,8 @@
     4.4  
     4.5  ###install-pm
     4.6  scp PM/* $ssh_user@$host:/tmp
     4.7 -ssh $ssh_user@$host 'cd /tmp; tar xfz Term-VT102*.gz; cd Term-VT102*[^z]; perl Makefile.PL; make ; make install'
     4.8 -#ssh $ssh_user@$host 'cd /tmp; tar xfz Text-Iconv*.gz; cd Text-Iconv*[^z]; perl Makefile.PL; make ; make install'
     4.9 +#ssh $ssh_user@$host 'cd /tmp; tar xfz Term-VT102*.gz; cd Term-VT102*[^z]; perl Makefile.PL; make ; make install'
    4.10 +ssh $ssh_user@$host 'cd /tmp; tar xfz Text-Iconv*.gz; cd Text-Iconv*[^z]; perl Makefile.PL; make ; make install'
    4.11  
    4.12  ###copy-lablogs
    4.13  for i in $dirs