lilalo

changeset 28:450b6ac9b657

Незначительные исправления:
* Исправлена обработка diff-файлов. Теперь они обрабатываются
в реальном времени
* Указан путь к mywi-client
* Исправлен путь к иконкам google/freebsd/linux
author devi
date Mon Nov 07 12:23:13 2005 +0200 (2005-11-07)
parents 098664cf339c
children b3f5f5560802
files l3-agent l3-frontend l3config.pm
line diff
     1.1 --- a/l3-agent	Mon Nov 07 11:24:49 2005 +0200
     1.2 +++ b/l3-agent	Mon Nov 07 12:23:13 2005 +0200
     1.3 @@ -18,7 +18,7 @@
     1.4  
     1.5  our @Command_Lines;
     1.6  our @Command_Lines_Index;
     1.7 -our @Diffs;
     1.8 +our %Diffs;
     1.9  our %Sessions;
    1.10  
    1.11  our %Commands_Stat;		# Statistics about commands usage
    1.12 @@ -57,6 +57,9 @@
    1.13  		my @files = <$path/$template>;
    1.14  		my $i=0;
    1.15  		for my $file (@files) {
    1.16 +
    1.17 +			next if defined($Diffs{$file});
    1.18 +			
    1.19  			my %diff;
    1.20  			
    1.21  			$diff{"path"}=$path;
    1.22 @@ -98,7 +101,8 @@
    1.23  			$diff{"text"}=$text;
    1.24  			#print "$file loaded ($diff{day})\n";
    1.25  
    1.26 -			push @Diffs, \%diff;
    1.27 +			#push @Diffs, \%diff;
    1.28 +			$Diffs{$file} = \%diff;
    1.29  			$i++;
    1.30  		}
    1.31  	}	
    1.32 @@ -121,7 +125,8 @@
    1.33  
    1.34  	my $min_dt = 10000;
    1.35  
    1.36 -	for my $diff (@Diffs) {
    1.37 +	for my $diff_key (keys %Diffs) {
    1.38 +			my $diff = $Diffs{$diff_key};
    1.39  			# Check here date, time and user
    1.40  			next if ($diff->{"day"} && $cl->{"day"} && ($cl->{"day"} ne $diff->{"day"}));
    1.41  			#next if (!$diff->{"uid"} && $cl->{"euid"} != $diff->{"uid"});
    1.42 @@ -135,7 +140,8 @@
    1.43  				$diff->{"time_range"}=$dt;
    1.44  				$diff->{"bind_to"}=$cl;
    1.45  
    1.46 -				$cl->{"diff"} = $diff->{"index"};
    1.47 +				#$cl->{"diff"} = $diff->{"index"};
    1.48 +				$cl->{"diff"} = $diff_key;
    1.49  				$min_dt = $dt;	
    1.50  			}
    1.51  		
    1.52 @@ -262,7 +268,7 @@
    1.53  						$session{$1} = $2;
    1.54  					}
    1.55  					$local_session_id = $session{"local_session_id"} if $session{"local_session_id"};
    1.56 -					$Sessions{$session_id}=\%session;
    1.57 +					$Sessions{$local_session_id}=\%session;
    1.58  				}
    1.59  
    1.60  				#Загруженную информацию сразу же отправляем в поток
    1.61 @@ -816,7 +822,7 @@
    1.62  		print OUT "</output>\n";
    1.63  		if ($cl->{"diff"}) {
    1.64  			print OUT "<diff>";
    1.65 -				printq(\*OUT,${$Diffs[$cl->{"diff"}]}{"text"});
    1.66 +				printq(\*OUT,${$Diffs{$cl->{"diff"}}}{"text"});
    1.67  			print OUT "</diff>\n";
    1.68  		}
    1.69  		print OUT "</command>\n";
    1.70 @@ -846,9 +852,6 @@
    1.71  
    1.72  sub send_cache
    1.73  {
    1.74 -	`logger "step 0"`;
    1.75 -	`logger "step 1"`;
    1.76 -
    1.77  	# Если в кэше что-то накопилось, 
    1.78  	# попытаемся отправить это на сервер
    1.79  	#
    1.80 @@ -913,9 +916,6 @@
    1.81  	init_variables();
    1.82  	init_config();
    1.83  
    1.84 -	for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) {
    1.85 -		load_diff_files($lab_log);
    1.86 -	}
    1.87  
    1.88  	if ($Config{"mode"} ne "daemon") {
    1.89  
    1.90 @@ -925,6 +925,9 @@
    1.91  	результат выполнения в результриующий файл.
    1.92  	После этого завершить работу.
    1.93  =cut
    1.94 +		for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) {
    1.95 +			load_diff_files($lab_log);
    1.96 +		}
    1.97  		load_command_lines($Config{"input"}, $Config{"input_mask"});
    1.98  		sort_command_lines;
    1.99  		process_command_lines;
   1.100 @@ -970,6 +973,9 @@
   1.101  		while (not $Killed) {
   1.102  			@Command_Lines = ();
   1.103  			@Command_Lines_Index = ();
   1.104 +			for my $lab_log (split (/\s+/, $Config{"diffs"} || $Config{"input"})) {
   1.105 +				load_diff_files($lab_log);
   1.106 +			}
   1.107  			load_cache_stat();
   1.108  			load_command_lines($Config{"input"}, $Config{"input_mask"});
   1.109  			if (@Command_Lines) {
     2.1 --- a/l3-frontend	Mon Nov 07 11:24:49 2005 +0200
     2.2 +++ b/l3-frontend	Mon Nov 07 12:23:13 2005 +0200
     2.3 @@ -58,7 +58,7 @@
     2.4  	for my $command (split /\s+/,$commands) {
     2.5  		$command =~ s/'//g;
     2.6  		my $description="";
     2.7 -		eval { $description=`mywi-client '$command'`; } ;
     2.8 +		eval { $description=`/home/devi/bin/mywi-client '$command'`; } ;
     2.9  		$description = join ("<br>\n", grep(/\([18]\)/, split(/\n/, $description)));
    2.10  		$description =~ s/.*?-//;
    2.11  		next if $description =~ /^\s*$/; 
    2.12 @@ -457,15 +457,15 @@
    2.13  
    2.14  %Search_Machines = (
    2.15  		"google" => 	{ 	"query" => 	"http://www.google.com/search?q=" ,
    2.16 -					"icon" 	=> 	"google.ico" },
    2.17 +					"icon" 	=> 	"$Config{frontend_google_ico}" },
    2.18  		"freebsd" => 	{ 	"query" => 	"http://www.freebsd.org/cgi/man.cgi?query=",
    2.19 -					"icon"	=>	"freebsd.ico" },
    2.20 +					"icon"	=>	"$Config{frontend_freebsd_ico}" },
    2.21  		"linux"  => 	{ 	"query" => 	"http://man.he.net/?topic=",
    2.22 -					"icon"	=>	"linux.ico"},
    2.23 +					"icon"	=>	"$Config{frontend_linux_ico}"},
    2.24  		"opennet"  => 	{ 	"query" => 	"http://www.opennet.ru/search.shtml?words=",
    2.25 -					"icon"	=>	"opennet.ico"},
    2.26 +					"icon"	=>	"$Config{frontend_opennet_ico}"},
    2.27  		"local" => 	{ 	"query" => 	"http://www.freebsd.org/cgi/man.cgi?query=",
    2.28 -					"icon"	=>	"freebsd.ico" },
    2.29 +					"icon"	=>	"$Config{frontend_local_ico}" },
    2.30  
    2.31  	);
    2.32  
     3.1 --- a/l3config.pm	Mon Nov 07 11:24:49 2005 +0200
     3.2 +++ b/l3config.pm	Mon Nov 07 12:23:13 2005 +0200
     3.3 @@ -11,7 +11,7 @@
     3.4  		"skip_empty" 			=> 	"yes",
     3.5  		"skip_interrupted" 		=>	"no",
     3.6  		"skip_wrong" 			=>	"no",
     3.7 -		"editors"			=>	["vi", "pico", "ee", "vim"],
     3.8 +		"editors"			=>	["vi", "pico", "ee", "vim", "nano"],
     3.9  		"pagers"			=>	["more", "less", "zmore", "zless", "info", 
    3.10  							"man", "mc", "trafshow", "screen", "cfdisk",
    3.11  							"trafshow-bsd", "yes", "lynx", "links", "centericq"